﻿#include "MainWindow.h"
#include "ui_MainWindow.h"
#include <QDebug>
#include <QGraphicsView>
#include <QHBoxLayout>
#include <QStackedWidget>
#include <QStatusBar>
#include <QVBoxLayout>

// #include "ElaContentDialog.h"
#include "QDockWidget.h"
// #include "ElaEventBus.h"
// #include "ElaLog.h"
#include "QMenu.h"
#include "QMenuBar.h"
#include "QProgressBar.h"
#include "QStatusBar.h"
#include "QLabel.h"
// #include "ElaTheme.h"
#include "QToolBar.h"
#include "QToolButton.h"
// #include "QMessageBar.h"
#include "vtkXMLUnstructuredGridReader.h"
#include "vtkErrorCode.h"
// #include "T_Navigation.h"
#include "CenterWidget.h"
#include <QFileInfo>
#include <QStandardItem>
#include <QVector>
#include <QList>
#include <QPair>
#include <QSharedPointer>
#include <QDoubleValidator>
#include "TextFileParser.h"
#include "SelectDatatDialog.h"
#include "parser/jsonParser.h"
#include "QPushButton.h"
#include <QTreeView.h>
#include "Graph2DWindowBase.h"
#include "Graph3DWindowBase.h"
#include "QMainWindow.h"
#include "BaseModule/IBaseSignal.h"
#include "BaseModule/GlobalHelper.h"
#include <set>
#include "Curve2DPlotor.h"
#include "ReisterDataType.h"
#include "BaseWidget/IdaDialogMsg.h"
#include <QApplication>
#include "PostEnumType.h"
#include <vtkUnstructuredGrid.h>
#include <vtkStructuredGrid.h>
#include <vtkDelimitedTextReader.h>
#include <vtkDelimitedTextWriter.h>
#include <vtkPolyData.h>
#include "MutiVTKFilesReader.h"
#include "NearFieldDataGenerator.h"
#include "FarFieldDataGenerator.h"
#include "ThreeDSurfacePlotSelectorDialog.h"
#include "ThreeDCloudMapSelectDataDialog.h"
#include "DialogHeatGraph2DSettings.h"
#include "SurfaceElectricFieldMapSelectDataDialog.h"
#include <vtkStructuredGridWriter.h>
#include "ThreeDCloudMapWindow.h"
#include "ThreeDSurfacePlotWindow.h"
#include "PolarCoordinateGraphWindow.h"
#include "DialogDataImportConfiguration.h"
#include "DataImportConfigurationData.h"
#include "DialogPythonScriptEditing.h"
#include "BaseWidget/SAFramelessHelper.h"
#include "LineChartWindow.h"
#include "PostCommand/PostCommandPy.h"
#include "SurfaceElectricFieldMapWindow.h"
#include "TableDisplayWindow.h"
#include "InfomationGraph3DBasical.h"
#include "MutiVTUFilesReader.h"
#include "VTPFilesReader.h"
#include "PolarGraph.h"
#include "HeatMapWindow.h"
#include <tlhelp32.h>
#include "ui_DialogCurveSmoothing.h"
#include "IdaWidgetHelper.h"
#include "vtkTable.h"
#include "vtkFieldData.h"
#include "vtkDoubleArray.h"
#include "vtkStringArray.h"
#include "ScreenCaptureWidget.h"
#include "PoseSettingData.h"
#include "TextFileReader.h"
#include "TextArrayMetaHander.h"
#include "TextExpander.h"
#include "BaseWidget/IWidgetSignal.h"
#include "ui_DialogImportProjectFirst.h"
#include "ui_DialogImportProjectSecond.h"
#include "AnimationTooBarInfoData.h"
#include "DialogSelectAttachmentPointPath.h"
#include "TableChatWindow.h"
#include "DataManager/ProjectTreeData.h"
#include "DataManager/WindowTotalData.h"
#include "ProjectManager/ProjectFileIO.h"
#include <QVTKOpenGLNativeWidget.h>
#include "PostComboBox.h"
#include "PostLineEdit.h"


//---------------以下是生成报告相关----------------
DWORD GetProcessIdByName1(const char* processName)
{
    DWORD processId = 0;
    HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
    if (snapshot != INVALID_HANDLE_VALUE)
    {
        PROCESSENTRY32 processEntry;
        processEntry.dwSize = sizeof(PROCESSENTRY32);
        if (Process32First(snapshot, &processEntry))
        {
            do
            {
                if (strcmp(processEntry.szExeFile, processName) == 0)
                {
                    processId = processEntry.th32ProcessID;
                    break;
                }
            } while (Process32Next(snapshot, &processEntry));
        }
        CloseHandle(snapshot);
    }
    return processId;
}

// 清空剪切板
void ClearClipboard()
{
    if (OpenClipboard(nullptr))
    {
        EmptyClipboard();
        CloseClipboard();
    }
}

// 检查剪切板中是否有图像数据
bool IsClipboardImageAvailable()
{
    if (OpenClipboard(nullptr))
    {
        bool hasImage = (GetClipboardData(CF_BITMAP) != nullptr);
        CloseClipboard();
        return hasImage;
    }
    return false;
}
//---------------以上是生成报告相关----------------

namespace pst
{
    //只允许输入限定范围的数据。否则直接不显示到输入框
    class StrictRangeDoubleValidator : public QDoubleValidator
    {
    public:
        StrictRangeDoubleValidator(double bottom, double top, int decimals, QObject* parent = nullptr)
            : QDoubleValidator(bottom, top, decimals, parent)
        {
            setNotation(QDoubleValidator::StandardNotation);
        }

        State validate(QString& input, int& pos) const override
        {
            // 1. 基类格式与小数位初步校验
            State st = QDoubleValidator::validate(input, pos);
            if (st == Invalid)
                return Invalid;

            // 2. 数值范围校验：只要能转成数字并且超范围，就拒绝
            bool ok = false;
            double v = locale().toDouble(input, &ok);
            if (ok && (v < bottom() || v > top()))
                return Invalid;

            // 3. 其余情况（包括中间态的可继续输入）交给基类
            return st;
        }
    };

    QString g_outputDir;

    MainWindow::MainWindow(QWidget* parent)
        : IdaMainWindow(parent), m_textFileParser(new TextFileParser(this)), m_centerWidget(new CenterWidget(this)), m_selecetDataDialog(nullptr), m_menuSignalHandlerInstance(MainWindowSignalHandler::getInstance()), ui(new Ui::MainWindow()), m_lastSelectPath("")
    {
        g_outputDir = m_outputDir;
        ui->setupUi(this);
        initWindow();
        initMainToolBar();
        initHomePageToolBar();
        initDataAnalysisToolBar();
        initDisplayToolBar();
        slot_ActionHomePage();

        initStatusBar();
        // 中心窗口
        initContentWidget();

        // 注册数据类型
        ReisterDataType::registerMetaDataType();

        m_menuSignalHandlerInstance->setCenterWidget(m_centerWidget);
        m_menuSignalHandlerInstance->setMainWindow(this);

        auto _baseSignal = IBaseSignalInstance;
        connect(_baseSignal, &BaseModule::IBaseSignal::signal_sendQuestionMessageToUI, this, &MainWindow::slot_sendQuestionMessageToUI);
        connect(_baseSignal, &BaseModule::IBaseSignal::signal_sendErrorMessageToUI, this, &MainWindow::slot_sendErrorMessageToUI);
        connect(_baseSignal, &BaseModule::IBaseSignal::readDataFromProjectFile, m_menuSignalHandlerInstance, &MainWindowSignalHandler::readDataFromProjectFile);

        connect(this, &IdaMainWindow::signal_closeButtonClick, [&]()
                {
                bool _isAllowClose = true;
                //emit IBaseSignalInstance->signal_readyCloseApp(_isAllowClose);
                if (_isAllowClose)
                {
                    qDebug() << QStringLiteral("窗体关闭");
                    this->close();
                } });

        connect(IBaseSignalInstance, &BaseModule::IBaseSignal::signal_readyCloseApp, this, [=](bool& isClose)
                {
                // isClose = false;//false表示不允许关闭
                // IBaseSignalInstance->signal_sendErrorMessageToUI(QStringLiteral("程序正在运行中，暂时不能关闭，请稍候。"));
                EDialogMsgResult _result = IdaDialogMsg::showDialog(this, QStringLiteral("确定要退出统一后处理平台吗？"), EDialogMsg::Question);
                if (EDialogMsgResult::Second != _result)
                {
                    isClose = false;
                } });

        // 移动到中心
        // moveToCenter();
        GlobalHelperInstance->sendMsgToParentProcess(QString("{--}winId{||}%1{--}\n").arg(winId()));

        initConnections();

        GlobalHelperInstance->initProjectTempDir(false);
        // 初始化数据导入的配置数据
        DataImportConfigurationDataInstance->initDataImportConfigurationData();

        ReadStandardExampleData();
        ReadHIRFExtrapolation();

        setInitializationWindowMaximization();

        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_lineChartMeasureButtonClicked, this, [this](int meaureTypeInt, double value)
                { 
                    MeasureType meaureType = static_cast<MeasureType>(meaureTypeInt);
                    m_menuSignalHandlerInstance->slot_measureButtonClicked(meaureType,value);
            });
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_UpdateStatusBarInformation, this, &MainWindow::UpdateStatusBarInformation);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_updateAnimationButtonState, this, &MainWindow::slot_updateAnimationButtonState);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_updateThunderstormZoneButtonState, this, &MainWindow::slot_updateThunderstormZoneButtonState);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_setToolBarAnimationDataInfo, this, &MainWindow::slot_setToolBarAnimationDataInfo);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_setShowAnimationTextWidget, this, &MainWindow::slot_setShowAnimationTextWidget);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_getThreeDDataSources, this, &MainWindow::slot_getThreeDDataSources);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_getTwoDDataSources, this, &MainWindow::slot_getTwoDDataSources);
        connect(IBaseSignalInstance,&BaseWidget::IWidgetSignal::signal_saveGifSuccess,this,&MainWindow::slot_saveGifSuccess);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_setDisplayModelButtonCheckState, this, &MainWindow::slot_setDisplayModelButtonCheckState);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_setClipperButtonCheckState, this, &MainWindow::slot_setClipperButtonCheckState);
        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_setToolButtonExportMotionGraph2InterfaceState, this, &MainWindow::slot_setToolButtonExportMotionGraph2InterfaceState);
    }

    MainWindow::~MainWindow()
    {
        RecycleAllReader();

        // for (auto i : m_nearFieldDataGeneratorList)
        //{
        //     if (i != nullptr) delete i; i = nullptr;
        // }

        // for (auto i : m_farFieldDataGeneratorList)
        //{
        //     if (i != nullptr) delete i; i = nullptr;
        // }
    }

    void MainWindow::slot_updateWidgetCursor(Qt::CursorShape shap)
    {
        // m_controlPanel->updateWidgetCursor(shap);
        // m_dockPanel->updateWidgetCursor(shap);
        this->setCursor(shap);
    }

    void MainWindow::setToolButtonDynamicTypeText(const QString& text)
    {
        m_toolButtonDynamicType->setText(text);
    }

    QString MainWindow::getToolButtonDynamicTypeText() const
    {
        return m_toolButtonDynamicType->text();
    }

    QString MainWindow::getClipperNormalDirection() const
    {
        return m_comboBoxClipperNormal->currentText();
    }

    double MainWindow::getClipperOriginDistance() const
    {
        return m_lineEditClipperOrigin->text().toDouble();
    }

    void MainWindow::slot_resetWidgetCursor()
    {
        // m_controlPanel->resetWidgetCursor();
        // m_dockPanel->resetWidgetCursor();
        this->unsetCursor();
    }

    // 北航集成hirf的读文件
    // void MainWindow::slot_importProjectData()
    //{
    //     auto t1 = clock();
    //     QString filePath = m_inputDir + "/data.txt";
    //     //auto filePath = R"(D:\data\同济\data.txt)";
    //     std::cout << " filePath = " << filePath.toStdString() << std::endl;
    //     m_textReader->setFilePath(filePath);
    //     m_textReader->setSplitter(" ");
    //     QString errorMsg{};
    //     auto isOk = m_textReader->doRead(errorMsg);
    //     auto t2 = clock();

    //    //m_textFileParser = new TextFileParser(this);
    //    //m_textFileParser->SetFileName(filePath);
    //    //m_textFileParser->Update();
    //    auto t3 = clock();

    //    std::cout << "time1 = " << t2 - t1 << std::endl;
    //    std::cout << "time2 = " << t3 - t2 << std::endl;
    //    if (!isOk)
    //    {
    //        QMessageBar::error(ElaMessageBarType::PositionPolicy::BottomLeft, "错误", errorMsg, 1000, this);
    //        return;
    //    }
    //    QToolButton* _btn = dynamic_cast<QToolButton*>(sender());
    //    QMessageBar::success(ElaMessageBarType::PositionPolicy::BottomLeft, _btn->text(), "成功", 1000, this);

    //    auto qFileInfo = QFileInfo(filePath);
    //    //m_fileType[filePath] = "File2DCurve";
    //    QStandardItem* item = new QStandardItem(qFileInfo.fileName());
    //    FileInfo info;
    //    info.m_filePath = filePath;
    //    info.m_fileType = FileDataType::File2DCurve;
    //    m_fileType[item] = info;
    //    m_centerWidget->addFileNode(item);
    //}

    bool MainWindow::slot_readTxtData(const QString& filePath, QStandardItem* item, const QStringList& geometryFileName, const ResultDataPointer& resultDataPointer)
    {
        TextFileReader* textFileReader = new TextFileReader(this);
        textFileReader->SetFileName(filePath);
        if (resultDataPointer.isNull())
        {
            textFileReader->setFileDealType(-1);
            textFileReader->setFileComponentType(0);
        }
        else
        {
            const auto& resultFileInfo = resultDataPointer->resultFileInfo;
            if (resultFileInfo.isNull())
            {
                textFileReader->setFileDealType(-1);
            }
            else
            {
                const auto& resultFileInfoPointer = resultFileInfo.toStrongRef();
                textFileReader->setFileDealType(resultFileInfoPointer->result_type);
                textFileReader->setFileComponentType(resultFileInfoPointer->result_data_type);
            }
        }
        bool isSuccess = textFileReader->update();
        if (!isSuccess)
        {
            delete textFileReader;
            return isSuccess;
        }

        TextExpander* textExpander = new TextExpander(this);
        textExpander->setInputTable(textFileReader->getOutputTable());
        textExpander->setFileDealType(textFileReader->getFileDealType());
        bool isOk1 = textExpander->update();
        if (!isOk1)
        {
            delete textExpander;
            return isOk1;
        }

        TextFileParser* textFileParser = new TextFileParser(this);
        textFileParser->SetFileName(filePath);
        textFileParser->SetInputTable(textExpander->getExpandedTable());

        // TODO 设置文件类型
        textFileParser->setFileDealType(textFileReader->getFileDealType());
        textFileParser->setFileComponentType(textFileReader->getFileComponentType());
        bool isOk = textFileParser->Update();
        if (!isOk)
        {
            delete textFileParser;
            return isOk;
        }
        textFileParser->SetOtherList({textFileParser});
        textFileParser->SetGeometryFileName(geometryFileName);
        m_txtReader[item] = textFileParser;
        m_pyTextParserList.append(textFileParser);

        return true;
    }

    bool MainWindow::slot_readVTUData(const QString& filePath, QStandardItem* item, const QStringList& geometryFileName)
    {
        if (filePath.isEmpty())
        {
            return false;
        }
        // QString filePath = filepath;
        MutiVTUFilesReader* reader = MutiVTUFilesReader::New();
        reader->SetFileName(filePath.toStdString().c_str());
        reader->Update();
        int errorCode = reader->GetErrorCode();
        if (errorCode != 0)
        {
            // int lastErrorCode = reader->GetErrorCode();
            // const char* lastErrorString = vtkErrorCode::GetStringFromErrorCode(lastErrorCode);
            // QMessageBar::error(ElaMessageBarType::PositionPolicy::BottomLeft, "错误", lastErrorString, 1000, this);
            m_errorMessageList.append(filePath);
            qDebug() << "Read 3D Data failed! ErrorCode = " << errorCode << " Path is " << filePath;
            reader->Delete();
            return false;
        }

        reader->SetOtherList({reader});
        reader->SetGeometryFileName(geometryFileName);
        m_vtuReader[item] = reader;
        m_pyVtuReaderList.append(reader);
        return true;

        // QToolButton* _btn = dynamic_cast<QToolButton*>(sender());
        // QMessageBar::success(ElaMessageBarType::PositionPolicy::BottomLeft, "读取三维数据", "成功", 1000, this);

        // QFileInfo qFileInfo(filePath);
        // QStandardItem* item = new QStandardItem(qFileInfo.fileName());
        ////FileInfo info;
        ////info.m_filePath = filePath;
        ////info.m_fileType = FileDataType::File3DGraph;
        ////m_centerWidget->addFileNode(item);

        ////后续应该改为从JsonParser读取三维结果
        // QSharedPointer<ResultDataInfo> info = QSharedPointer<ResultDataInfo>(new ResultDataInfo);
        // info->path = filePath;
        // info->fileType = FileDataType::FileSurfaceElectricFieldGraph;
        // m_fileType[item] = info;
        // m_centerWidget->addFileNode(item);
        // m_vtuReader[item] = reader;
    }

    bool MainWindow::slot_readVTKData(const QString& filePath, QStandardItem* item, const QStringList& geometryFileName)
    {
        if (filePath.isEmpty())
        {
            return false;
        }
        MutiVTKFilesReader* reader = new MutiVTKFilesReader();
        reader->SetFileName(filePath.toStdString().c_str());
        QString errorInfo;
        bool isOk = reader->Update(errorInfo);

        if (!isOk)
        {
            m_errorMessageList.append(filePath);
            qDebug() << "Read vtk data failed! ErrorInfo = " << errorInfo << " Path is " << filePath;
            delete reader;
            return false;
        }

        reader->SetOtherList({reader});
        reader->SetGeometryFileName(geometryFileName);
        m_vtkReader[item] = reader;
        m_pyVtkReaderList.append(reader);
        return true;
        // QFileInfo qFileInfo(filePath);
        // QStandardItem* item = new QStandardItem(qFileInfo.fileName());
        ////后续应该改为从JsonParser读取三维结果
        // QSharedPointer<ResultDataInfo> info = QSharedPointer<ResultDataInfo>(new ResultDataInfo);
        // info->path = filePath;
        // info->fileType = FileDataType::FileSurfaceElectricFieldGraph;
        // m_fileType[item] = info;
        // m_centerWidget->addFileNode(item);
        // m_vtkReader[item] = reader;
    }

    bool MainWindow::slot_readVTPData(const QString& filePath, QStandardItem* item, const QStringList& geometryFileName)
    {
        if (filePath.isEmpty())
        {
            return false;
        }
        // QString filePath = filepath;

        vtkNew<VTPFilesReader> reader;
        reader->SetFileName(filePath.toStdString().c_str());
        reader->Update();
        int errorCode = reader->GetErrorCode();
        if (errorCode != 0)
        {
            // int lastErrorCode = reader->GetErrorCode();
            // const char* lastErrorString = vtkErrorCode::GetStringFromErrorCode(lastErrorCode);
            // QMessageBar::error(ElaMessageBarType::PositionPolicy::BottomLeft, "错误", lastErrorString, 1000, this);
            m_errorMessageList.append(filePath);
            qDebug() << "Read 3D Data failed! ErrorCode = " << errorCode << " Path is " << filePath;
            // reader->Delete();
            return false;
        }

        reader->SetOtherList({reader});
        reader->SetGeometryFileName(geometryFileName);
        m_vtpReader[item] = reader;
        m_pyVtpReaderList.append(reader);
        return true;
    }

    void MainWindow::slot_checkGraphType(const QList<QStandardItem*>& indexs)
    {
        QList<FileDataTypes> inputType;

        for (auto index : indexs)
        {
            auto it = m_fileType.find(index);
            if (it != m_fileType.end())
            {
                inputType.append(it.value()->fileType);
            }
        }
        bool is2D = false;
        bool isPolar = false;
        bool isSurfaceElectricField = false;
        bool isTwoDHeatMap = false;
        bool isThreeDCloudMap = false;
        bool isThreeDSurfacePlot = false;
        bool TwoDPeakValleyGraph = false;
        bool isDataTable = false;
        checkFileType(inputType, is2D, isPolar, isSurfaceElectricField,
                      isTwoDHeatMap, isThreeDCloudMap, isThreeDSurfacePlot, TwoDPeakValleyGraph, isDataTable);

        if (indexs.size() > 1) // 不允许同时选择多个3D图
        {
            isSurfaceElectricField = false;
        }
        m_toolButtonSurfaceElectricFieldMap->setEnabled(isSurfaceElectricField);
        m_toolButton2DGraph->setEnabled(is2D);
        m_toolButtonTwoDHeatMap->setEnabled(isTwoDHeatMap);
        m_toolButtonPolarGraph->setEnabled(isPolar);
        m_toolButton3DCloudMap->setEnabled(isThreeDCloudMap);
        m_toolButton3DSurfacePlot->setEnabled(isThreeDSurfacePlot);
        m_toolButtonTable->setEnabled(isDataTable);
        // TODO 其他类型的图 先不限制能不能显示
        m_currentChosenFiles = indexs;
        m_centerWidget->setFileTypeList({is2D, isPolar, isSurfaceElectricField, isTwoDHeatMap, isThreeDCloudMap, isThreeDSurfacePlot, TwoDPeakValleyGraph, isDataTable});
    }

    void MainWindow::slot_displayNew2DGraph(bool isOpenNewWindow)
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        m_selectFileList.clear();
        m_optionalKeyList.clear();
        for (const auto& item : m_currentChosenFiles)
        {
            auto it = m_txtReader.find(item);
            if (it != m_txtReader.end())
            {
                m_selectFileList.append(it.value());
            }
        }
        // 多个结果文件同时选中绘制
        if (m_selectFileList.size() > 1)
        {
            QList<QString> repeatList;
            for (const QString& str : m_selectFileList.first()->getEachColNameOfKey())
            {
                repeatList.append(str.toLower());
            }
            for (int i = 0; i < m_selectFileList.size(); ++i)
            {
                auto& textFileParser = m_selectFileList.at(i);
                QList<QString> tmp;
                for (const QString& str : textFileParser->getEachColNameOfKey())
                {
                    const QString& s = str.toLower();
                    if (repeatList.contains(s) && !tmp.contains(s))
                    {
                        tmp.append(s);
                    }
                }
                repeatList = std::move(tmp);
                if (repeatList.isEmpty())
                {
                    break;
                }
            }
            m_optionalKeyList = std::move(repeatList); // 记录交集的key列表
            // 没有交集的key
            if (m_optionalKeyList.isEmpty())
            {
                // QMessageBar::error(ElaMessageBarType::PositionPolicy::BottomLeft, "错误", "没有公共key", 1000, this);
                // ElaContentDialog* errorDialog = new ElaContentDialog(this);
                // errorDialog->setMiddleButtonVisible(false);
                // errorDialog->setTitleText(tr("提示"));
                // errorDialog->setContentText(tr("数据变量不一致，请重新选择工程文件"));
                // errorDialog->exec();
                emit IBaseSignalInstance->signal_sendErrorMessageToUI("数据变量不一致，请重新选择工程文件");
                return;
            }
        }
        ShowSelecetDataDialog(isOpenNewWindow);

        // for (auto index : m_currentChosenFiles)
        //{
        //     auto it = m_fileType.find(index);
        //     if (it != m_fileType.end())
        //     {
        //         m_centerWidget->display2DGraph(it.value().m_filePath);
        //     }
        // }
        ////顶级选择数据对话框

        //////次级选择数据对话框
        // DataChosenListDialog* m_dataChosenListDialog = new DataChosenListDialog(this);
        // m_dataChosenListDialog->setFixedSize(400, 400);
        // m_dataChosenListDialog->moveToCenter();
        // QList<QString> data{ "-180deg", "-90deg", "0deg", "90deg", "180deg" };
        // m_dataChosenListDialog->setData(data);
        // m_dataChosenListDialog->show();
        // m_dataChosenListDialog->updateUI();
        // QList<int> indexs{ 1, 2 };
        // m_dataChosenListDialog->setSelctedIndexs(indexs);

        //        //只取第首个文件
        // if (m_currentChosenFiles.isEmpty())
        //{
        //    return;
        //}
        // auto index = m_currentChosenFiles.at(0);
        // auto it = m_fileType.find(index);
        // if (it != m_fileType.end())
        //{
        //    auto data = m_textReader->getAllData();
        //    if (data.size() < 2)
        //    {
        //        QMessageBar::error(ElaMessageBarType::PositionPolicy::BottomLeft, "错误", "数据列数不足", 1000, this);
        //        return;
        //    }
        //    auto x = data[0];
        //    for (int i = 1; i < data.size(); i++)
        //    {
        //        auto& y = data[i];
        //        m_centerWidget->addLineToGrapg2D(x, y);
        //    }
        //    //展示数据
        //}
    }

    void MainWindow::slot_displayNewSurfaceElectricFieldGraph(bool isOpenNewWindow)
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        auto selectedItems = m_centerWidget->getSelectedItems();

        // QList<InfomationGraph3DBasical> infoList;
        for (auto item : selectedItems)
        {
            auto it = m_fileType.find(item);
            if (it != m_fileType.end())
            {
                InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
                PoseSettingData* poseSettingData = new PoseSettingData(this);
                const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
                if (!resultFileInfo.isNull())
                {
                    const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                    poseSettingData->setTranslationX(Antenna_position.position_X);
                    poseSettingData->setTranslationY(Antenna_position.position_Y);
                    poseSettingData->setTranslationX(Antenna_position.position_Z);
                    poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                    poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                    info->m_resultType = resultFileInfo.toStrongRef()->result_type;
                }
                info->m_poseSettingData = poseSettingData;
                if (m_vtuReader.contains(item)) // 判断是否是vtu格式
                {
                    info->m_reader = m_vtuReader[item];
                    info->readerIndex = m_pyVtuReaderList.indexOf(m_vtuReader[item]);
                    info->readerType = "vtu";
                    info->m_graphType = GraphType::SurfaceElectricFieldMap;
                    info->m_filePath = m_vtuReader[item]->GetFileName();
                    info->m_data = m_vtuReader[item]->GetOutput();
                    info->m_name = item->text();
                    info->m_geometryFileName = m_vtuReader[item]->GetGeometryFileName();
                }
                else if (m_vtkReader.contains(item))
                {
                    info->m_reader = m_vtkReader[item];
                    info->readerIndex = m_pyVtkReaderList.indexOf(m_vtkReader[item]);
                    info->readerType = "vtk";
                    info->m_graphType = GraphType::SurfaceElectricFieldMap;
                    info->m_filePath = m_vtkReader[item]->GetFileName();
                    info->m_data = m_vtkReader[item]->GetOutput();
                    info->m_name = item->text();
                    info->m_geometryFileName = m_vtkReader[item]->GetGeometryFileName();
                }
                else if (m_vtpReader.contains(item))
                {
                    info->m_reader = m_vtpReader[item];
                    info->readerIndex = m_pyVtpReaderList.indexOf(m_vtpReader[item]);
                    info->readerType = "vtp";
                    info->m_graphType = GraphType::SurfaceElectricFieldMap;
                    info->m_filePath = m_vtpReader[item]->GetFileName();
                    info->m_data = m_vtpReader[item]->GetOutput();
                    info->m_name = item->text();
                    info->m_geometryFileName = m_vtpReader[item]->GetGeometryFileName();
                }
                else
                {
                    return;
                }

                auto fieldGraphGenerator = new FieldGraphGenerator(this);
                fieldGraphGenerator->SetInputDataSet(info->m_data);
                auto pointArray = fieldGraphGenerator->GetPointsArrayIndexAndNames();
                auto cellArray = fieldGraphGenerator->GetCellsArrayIndexAndNames();
                info->m_allPointArray = pointArray;
                info->m_allCellArray = cellArray;
                info->m_fieldGraphGenerator = fieldGraphGenerator;
                QString sourceStr;
                slot_getThreeDDataSources(info->m_reader, sourceStr);
                info->m_dataSources = sourceStr;
                // 设置item
                info->m_projectTreeSourceItem = item;
                const auto& resultData = m_fileType.value(item);
                if (!resultData->mulitFileInfo.second.isEmpty())
                {
                    const auto& pair = resultData->mulitFileInfo.first;
                    info->m_fieldType = pair.first;
                    info->m_unit = pair.second;
                    for (const auto& tmpPair : resultData->mulitFileInfo.second)
                    {
                        info->m_VarValueList.append(tmpPair.first);
                    }
                }
                //if (!info->m_allCellArray.isEmpty() || !info->m_allPointArray.isEmpty())
                {
                    auto dialog = new SurfaceElectricFieldMapSelectDataDialog(this);
                    connect(dialog, &SurfaceElectricFieldMapSelectDataDialog::signal_sentChosenArrayInfo, this, &MainWindow::slot_sentChosenArrayInfo);
                    dialog->setIsOpenNewWindow(isOpenNewWindow);
                    dialog->setInfomationGraph3DBasical(info);
                    if (!info->m_allCellArray.isEmpty() || !info->m_allPointArray.isEmpty())
                        dialog->showWindow();
                }
                //else
                {
                    //slot_sentChosenArrayInfo(info, isOpenNewWindow);
                }
            }
        }
        // m_centerWidget->addImageToGraph3DWindow(infoList, m_openNewWindow);
        // m_openNewWindow = true;
    }

    void MainWindow::slot_receiveSurfaceElectricFieldGraphData(int graphType, int currentIndex, int readerIndex, QString sReaderType, QString sFilePath, QString sName, QString geometryFileName, bool isOpenNewWindow)
    {
        InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
        if ("vtu" == sReaderType)
        {
            info->m_reader = m_pyVtuReaderList[readerIndex];
            info->m_data = m_pyVtuReaderList[readerIndex]->GetOutput();

            QString sourceStr;
            slot_getThreeDDataSources(m_pyVtuReaderList[readerIndex], sourceStr);
            info->m_dataSources = sourceStr;
        }
        else if ("vtk" == sReaderType)
        {
            info->m_reader = m_pyVtkReaderList[readerIndex];
            info->m_data = m_pyVtkReaderList[readerIndex]->GetOutput();

            QString sourceStr;
            slot_getThreeDDataSources(m_pyVtkReaderList[readerIndex], sourceStr);
            info->m_dataSources = sourceStr;
        }
        else if ("vtp" == sReaderType)
        {
            info->m_reader = m_pyVtpReaderList[readerIndex];
            info->m_data = m_pyVtpReaderList[readerIndex]->GetOutput();

            QString sourceStr;
            slot_getThreeDDataSources(m_pyVtpReaderList[readerIndex], sourceStr);
            info->m_dataSources = sourceStr;
        }

        else
        {
            return;
        }
        info->m_graphType = (GraphType)graphType;
        info->m_valueGroupNameIndex = currentIndex;
        info->m_filePath = sFilePath;
        info->m_name = sName;
        QStringList geometryFileNames = geometryFileName.split(",", QString::SkipEmptyParts);
        info->m_geometryFileName = geometryFileNames;
        auto fieldGraphGenerator = new FieldGraphGenerator(this);
        fieldGraphGenerator->SetInputDataSet(info->m_data);
        auto pointArray = fieldGraphGenerator->GetPointsArrayIndexAndNames();
        auto cellArray = fieldGraphGenerator->GetCellsArrayIndexAndNames();
        info->m_allPointArray = pointArray;
        info->m_allCellArray = cellArray;

        if (currentIndex != -1)
        {
            QList<FieldGraphGenerator::ArrayInformation> addedArrayList;
            for (const auto& i : info->m_allPointArray)
            {
                if (i.arrayComponent == 1)
                {
                    addedArrayList.append(i);
                }
            }

            for (const auto& i : info->m_allCellArray)
            {
                if (i.arrayComponent == 1)
                {
                    addedArrayList.append(i);
                }
            }
            info->m_currentScalarArray = addedArrayList[currentIndex];
        }
        slot_sentChosenArrayInfo(info, isOpenNewWindow);
    }

    void MainWindow::slot_sentChosenArrayInfo(InfomationGraph3DBasical* info, bool isOpenNewWindow)
    {
        QList<InfomationGraph3DBasical*> infoList = {info};
        m_centerWidget->addImageToGraph3DWindow(infoList, isOpenNewWindow);
    }

    void MainWindow::slot_displayNewThreeDCloudMap(bool openNewWindow)
       {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        auto selectedItems = m_centerWidget->getSelectedItems();

        // 多个结果文件同时选中绘制
        // QList<InfomationGraph3DBasical> infoList;
        m_selectFileList.clear();
        for (const auto& item : m_currentChosenFiles)
        {
            auto it = m_txtReader.find(item);
            if (it != m_txtReader.end())
            {
                m_selectFileList.append(it.value());

                auto& textFileParser = it.value();

                InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);

                PoseSettingData* poseSettingData = new PoseSettingData(this);
                const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
                if (!resultFileInfo.isNull())
                {
                    const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                    poseSettingData->setTranslationX(Antenna_position.position_X);
                    poseSettingData->setTranslationY(Antenna_position.position_Y);
                    poseSettingData->setTranslationX(Antenna_position.position_Z);
                    poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                    poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                    info->m_resultType = resultFileInfo.toStrongRef()->result_type;
                }
                info->m_poseSettingData = poseSettingData;
                info->m_geometryFileName = textFileParser->GetGeometryFileName();

                info->m_reader = textFileParser;
                info->readerIndex = m_pyTextParserList.indexOf(textFileParser);
                info->m_graphType = GraphType::ThreeDCloudMap;
                info->m_filePath = textFileParser->GetFileName();
                // info.m_data = generator->getOutputData();
                info->m_name = item->text();
                info->m_resultData = m_fileType[item];
                info->resultDataIndex = m_pyFileTypeList.indexOf(info->m_resultData);
                // infoList.append(info);
                QString sourceStr;
                slot_getTwoDDataSources(textFileParser, sourceStr);
                info->m_dataSources = sourceStr;
                // 设置item
                info->m_projectTreeSourceItem = item;
                const auto& resultData = m_fileType.value(item);
                if (!resultData->mulitFileInfo.second.isEmpty())
                {
                    const auto& pair = resultData->mulitFileInfo.first;
                    info->m_fieldType = pair.first;
                    info->m_unit = pair.second;
                    for (const auto& tmpPair : resultData->mulitFileInfo.second)
                    {
                        info->m_VarValueList.append(tmpPair.first);
                    }
                }

                QVector<QString> valueNameList = textFileParser->getEachColGroupNameOfValue();

                ThreeDCloudMapSelectDataDialog* dialog = new ThreeDCloudMapSelectDataDialog(this);
                dialog->setValueNameList(valueNameList.toList());
                dialog->setIsOpenNewWindow(openNewWindow);
                dialog->setInfomationGraph3DBasical(info);
                dialog->showWindow();
                connect(dialog, &ThreeDCloudMapSelectDataDialog::signal_sentChosenValueNameIndex, this, &MainWindow::slot_sendChosen3DCloudData);

                // auto table = textFileParser->getOriginalTable();
                // auto generator = new NearFieldDataGenerator(this);
                ////auto& textFileParser = m_selectFileList.at(i)->resultData;
                ////auto table = textFileParser.getTextReader()->GetOutput();
                ////auto generator = new NearFieldDataGenerator(this);
                // generator->setInputData(table);
                ////generator->setReverseXYZ(true);
                // bool isOk = generator->update();
                // if (!isOk)
                //{
                //     qDebug() << " NearFieldDataGenerator update failed!";
                //     return;
                // }
                // m_nearFieldDataGeneratorList.append(generator);
            }
        }
        // m_centerWidget->addImageToGraph3DWindow(infoList, m_openNewWindow);
        // m_openNewWindow = true;

        // auto exeDir = QApplication::applicationDirPath();
        // QString fileName = exeDir + "/../examples/ThreeDCloudMap.txt";
        ////QString fileName = QFileDialog::getOpenFileName(
        ////    this, tr("选择 TXT 文件"), "", tr("文本文件 (*.txt);;所有文件 (*)"));

        // if (fileName.isEmpty())
        //{
        //     return;
        // }
        // m_centerWidget->addImageToNewSurfaceWindow(fileName);
        // m_openNewWindow = true;
    }

    void MainWindow::slot_receiveThreeDCloudMapData(bool openNewWindow, int graphType, int variableIndex, int readerIndex, QString filePath, QString name, QString geometryFileName, int resultDataIndex)
    {
        InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
        info->m_valueGroupNameIndex = variableIndex;
        info->m_reader = m_pyTextParserList[readerIndex];
        QString sourceStr;
        slot_getTwoDDataSources(m_pyTextParserList[readerIndex], sourceStr);
        info->m_dataSources = sourceStr;
        info->m_graphType = (GraphType)graphType;
        info->m_filePath = filePath;
        info->m_name = name;
        QStringList geometryFileNames = geometryFileName.split(",", QString::SkipEmptyParts);
        info->m_geometryFileName = geometryFileNames;
        info->m_resultData = m_pyFileTypeList[resultDataIndex];
        // slot_sendChosen3DCloudData(info);

        QList<InfomationGraph3DBasical*> infoList = {info};
        m_centerWidget->addImageToGraph3DWindow(infoList, openNewWindow);
    }

    void MainWindow::slot_displayNewThreeDSurfacePlot(bool isOpenNewWindow)
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        auto selectedItems = m_centerWidget->getSelectedItems();

        // 多个结果文件同时选中绘制
        // QList<InfomationGraph3DBasical> infoList;
        m_selectFileList.clear();
        for (const auto& item : m_currentChosenFiles)
        {
            auto it = m_txtReader.find(item);
            if (it != m_txtReader.end())
            {
                m_selectFileList.append(it.value());
                auto& textFileParser = it.value();
                auto table = textFileParser->getStandardTable();
                FarFieldDataGenerator* farFieldGenerator = new FarFieldDataGenerator(this);
                m_farFieldDataGeneratorList.append(farFieldGenerator);
                farFieldGenerator->setFileDealType(textFileParser->getFileDealType());
                farFieldGenerator->setInputData(table);

                QString errorMsg;
                bool isOk = farFieldGenerator->parseData(errorMsg);
                if (!isOk)
                {
                    qDebug() << " FarFieldDataGenerator update failed!";
                    return;
                }
                auto freList = farFieldGenerator->getFreqencyList();
                auto valueNameList = textFileParser->getEachColGroupNameOfValue();
                // auto valueNameList = farFieldGenerator->getValueNameList();

                if (freList.isEmpty() || valueNameList.isEmpty())
                {
                    qDebug() << " FarFieldDataGenerator update failed!";
                    return;
                }
                InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
                PoseSettingData* poseSettingData = new PoseSettingData(this);
                const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
                if (!resultFileInfo.isNull())
                {
                    const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                    poseSettingData->setTranslationX(Antenna_position.position_X);
                    poseSettingData->setTranslationY(Antenna_position.position_Y);
                    poseSettingData->setTranslationZ(Antenna_position.position_Z);
                    poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                    poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                    info->m_resultType = resultFileInfo.toStrongRef()->result_type;
                }
                info->m_poseSettingData = poseSettingData;
                info->m_geometryFileName = textFileParser->GetGeometryFileName();
                info->m_reader = textFileParser; // *
                info->readerIndex = m_pyTextParserList.indexOf(textFileParser);
                info->m_filePath = textFileParser->GetFileName();  // QString
                info->m_name = item->text();                       // QString
                info->m_graphType = GraphType::ThreeDSurfacePlot;  // int
                info->m_farFieldDataGenerator = farFieldGenerator; // *
                QString sourceStr;
                slot_getTwoDDataSources(textFileParser, sourceStr);
                info->m_dataSources = sourceStr;
                // 设置item
                info->m_projectTreeSourceItem = item;
                const auto& resultData = m_fileType.value(item);
                if (!resultData->mulitFileInfo.second.isEmpty())
                {
                    const auto& pair = resultData->mulitFileInfo.first;
                    info->m_fieldType = pair.first;
                    info->m_unit = pair.second;
                    for (const auto& tmpPair : resultData->mulitFileInfo.second)
                    {
                        info->m_VarValueList.append(tmpPair.first);
                    }
                }

                ThreeDSurfacePlotSelectorDialog* m_farFieldDataDialog = new ThreeDSurfacePlotSelectorDialog(this);
                m_farFieldDataDialog->setFreqencyList(freList);
                m_farFieldDataDialog->setIsOpenNewWindow(isOpenNewWindow);
                m_farFieldDataDialog->setValueList(valueNameList.toList());
                m_farFieldDataDialog->setInfomationGraph3DBasical(info);
                m_farFieldDataDialog->setFixedSize(250, 130);
                m_farFieldDataDialog->showWindow();

                connect(m_farFieldDataDialog, &ThreeDSurfacePlotSelectorDialog::signal_sendChosen3DSurfaceData,
                        this, &MainWindow::slot_sendChosen3DSurfaceData);
            }
        }

        // vtkNew<vtkStructuredGrid> resultData;
        // generator->getDataSetByFreqency(freList[0], false, false, resultData, valueNameList[0]);
        // m_addedFarFieldData.append(resultData);

        ////qDebug() << "resultData = ";
        ////resultData->Print(std::cout);
        // InfomationGraph3DBasical info;

        // info.m_reader = textFileParser;
        // info.m_graphType = GraphType::ThreeDSurfacePlot;
        // info.m_filePath = textFileParser->GetFileName();
        // info.m_data = resultData;
        // infoList.append(info);

        // m_centerWidget->addImageToGraph3DWindow(infoList, m_openNewWindow);
        // m_openNewWindow = true;
    }

    void MainWindow::slot_receiveThreeDSurfacePlotData(int graphType, int variableIndex, int frequencyIndex, int readerIndex, QString filePath, QString name, QString geometryFileName, bool isOpenNewWindow)
    {
        FarFieldDataGenerator* farFieldGenerator = new FarFieldDataGenerator(this);
        m_farFieldDataGeneratorList.append(farFieldGenerator);
        farFieldGenerator->setFileDealType(m_pyTextParserList[readerIndex]->getFileDealType());
        farFieldGenerator->setInputData(m_pyTextParserList[readerIndex]->getStandardTable());
        QString errorMsg;
        bool isOk = farFieldGenerator->parseData(errorMsg);
        if (!isOk)
        {
            qDebug() << " FarFieldDataGenerator update failed!";
            return;
        }

        InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
        info->m_reader = m_pyTextParserList[readerIndex];
        QString sourceStr;
        slot_getTwoDDataSources(m_pyTextParserList[readerIndex], sourceStr);
        info->m_dataSources = sourceStr;

        info->m_filePath = filePath;
        info->m_name = name;
        QStringList geometryFileNames = geometryFileName.split(",", QString::SkipEmptyParts);
        info->m_geometryFileName = geometryFileNames;
        info->m_graphType = (GraphType)graphType;
        info->m_farFieldDataGenerator = farFieldGenerator;
        slot_sendChosen3DSurfaceData(info, frequencyIndex, variableIndex, isOpenNewWindow);
    }

    void MainWindow::slot_displayInTableWidget()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        m_selectFileList.clear();
        for (const auto& item : m_currentChosenFiles)
        {
            auto it = m_txtReader.find(item);
            if (it != m_txtReader.end())
            {
                m_selectFileList.append(it.value());
            }
        }
        // 多个结果文件同时选中绘制

        for (int i = 0; i < m_selectFileList.size(); ++i)
        {
            auto& textFileParser = m_selectFileList.at(i);
            int readerIndex = m_pyTextParserList.indexOf(textFileParser);
            QStringList _pyCodes{};
            _pyCodes += QString("tablewidget = PostProcessing.TableWidget()");
            _pyCodes += QString("tablewidget.setReaderIndex(%1)").arg(readerIndex);
            _pyCodes += QString("tablewidget.create()");
            emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);
            slot_receiveTableData(readerIndex);
        }
    }

    void MainWindow::slot_pasteFile(QStandardItem* copyFileItem, QStandardItem* pasteFileItem)
    {
        // 粘贴文件类型
        QSharedPointer<ResultDataInfo> resultInfo = m_fileType.value(copyFileItem);
        m_fileType[pasteFileItem] = resultInfo;
        m_pyFileTypeList.append(resultInfo);
        // 粘贴不同类型的文件数据
        QString path = resultInfo->path;
        QFileInfo info(path);
        if (info.suffix() == "txt" || info.suffix() == "csv")
        {
            TextFileParser* textFileParser = m_txtReader[copyFileItem];
            m_txtReader[pasteFileItem] = textFileParser;
            m_pyTextParserList.append(textFileParser);
        }
        else if (info.suffix() == "vtu")
        {
            MutiVTUFilesReader* reader = m_vtuReader[copyFileItem];
            m_vtuReader[pasteFileItem] = reader;
            m_pyVtuReaderList.append(reader);
        }
        else if (info.suffix() == "vtk")
        {
            MutiVTKFilesReader* reader = m_vtkReader[copyFileItem];
            m_vtkReader[pasteFileItem] = reader;
            m_pyVtkReaderList.append(reader);
        }
        else if (info.suffix() == "vtp")
        {
            vtkSmartPointer<VTPFilesReader> reader = m_vtpReader[copyFileItem];
            m_vtpReader[pasteFileItem] = reader;
            m_pyVtpReaderList.append(reader);
        }
    }

    void MainWindow::slot_receiveTableData(int readerIndex)
    {
        auto textFileParser = m_pyTextParserList[readerIndex];
        InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
        info->m_reader = textFileParser;
        info->m_filePath = textFileParser->GetFileName();
        QStandardItem* item = m_centerWidget->getSelectedItems()[0];
        info->m_projectTreeSourceItem = item;
        QString sourcesStr;
        slot_getTwoDDataSources(textFileParser, sourcesStr);
        info->m_dataSources = sourcesStr;
        m_centerWidget->addDataToTableWindow(info, true);
    }

    void MainWindow::slot_saveGraphToLocal()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        if (currentGraph == nullptr)
        {
            emit IBaseSignalInstance->signal_sendErrorMessageToUI("当前无活动窗口");
            return;
        }

        QString fileName = QFileDialog::getSaveFileName(this, tr("保存图片"), "",                  // 默认文件名
                                                        tr("PNG 文件 (*.png);;JPG 文件 (*.jpg)")); // 文件过滤器

        if (fileName.isEmpty())
        {
            return;
        }
        UpdateStatusBarInformation(QStringLiteral("保存图片正在进行中..."), true);
        QCoreApplication::processEvents();

        bool _isSuccess = false;
        m_centerWidget->slot_saveScreenShot(fileName, &_isSuccess);
        if (!_isSuccess)
        {
            emit IBaseSignalInstance->signal_sendErrorMessageToUI("失败: " + fileName);
        }
        else
        {
            emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QString("保存图片成功！"), false);
            QStringList _pyCodes;
            _pyCodes.append(QString("PostProcessing.saveGraph('%1')").arg(fileName));
            emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);
        }
  
    }

    void MainWindow::slot_saveScript()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        QString _dir = QString("C:/");
        QString _suffix = "Python(*.py)";
        QString _title = QStringLiteral("保存脚本");
        QString _filenames = QFileDialog::getSaveFileName(this, _title, _dir, _suffix);
        if (_filenames.isEmpty())
            return;

        //QStringList _pyCodes{};
        //_pyCodes += QString("PostProcessing.smartScriptSave('%1')").arg(_filenames);
        //emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);

        UpdateStatusBarInformation(QStringLiteral("保存脚本正在进行中..."), true);
        QCoreApplication::processEvents();
        emit IBaseSignalInstance->signal_saveScript(_filenames);
    }
    void MainWindow::slot_editScript()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        QString _fillter = "Python(*.py)";
        QString _title = QStringLiteral("编辑脚本");
        QString _dir = QString("C:/");
        QString _filePath = QFileDialog::getOpenFileName(this, _title, _dir, _fillter);
        if (_filePath.isEmpty())
            return;

        // 选择文档单击打开，显示对话框，用于调试
        auto _dialog = new DialogPythonScriptEditing(this);
        connect(_dialog, &DialogPythonScriptEditing::sendNewText, this, [this](QString filePath, QString text) {
            QStringList _pyCodes{};
            _pyCodes += QString("PostProcessing.smartScriptEdit(\"%1\",\"%2\")").arg(filePath).arg(text);
            emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);
            });
        _dialog->setPythonScriptFilePath(_filePath);
        _dialog->showWindow();
        return;
    }
    void MainWindow::slot_operationScript()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        QString _fillter = "Python(*.py)";
        QString _title = QStringLiteral("运行脚本");
        QString _dir = QString("C:/");
        QString _filePath = QFileDialog::getOpenFileName(this, _title, _dir, _fillter);
        if (_filePath.isEmpty())
            return;

        QString sListPara;
        QString _pyCommand = QString("PostProcessing.smartScriptRun(\"%1\",%2,\"%3\")").arg(_filePath).arg(false).arg(sListPara);
        emit IBaseSignalInstance->signal_execPYCode(QStringList(_pyCommand));
    }

    void MainWindow::slot_sendSelectedInfo(int& variableIndex,
                                           QList<QPair<int, QList<int>>>& chosenData, QList<int>& valueIndexs, bool* isSuccess, QList<int> selectParserIndexs, bool isOpenNewWindow)
    {
        bool isRun = false;
        static QList<Info2DPointer> s_infoList; // 保存多文件选择后的所有结果
        if (m_selectFileList.isEmpty() && !selectParserIndexs.isEmpty())
        {
            isRun = true;
            m_selectFileList.clear();
            s_infoList.clear();
            for (auto index : selectParserIndexs)
            {
                if (index >= 0 && index < m_pyTextParserList.size())
                {
                    m_selectFileList.append(m_pyTextParserList.at(index));
                }
                else
                {
                    emit IBaseSignalInstance->signal_sendErrorMessageToUI("失败: selectParserIndexs错误");
                }
            }
        }
        bool _isSuccess = false;
        if (m_selectFileList.isEmpty())
        {
            s_infoList.clear();
            *isSuccess = _isSuccess;
            return;
        }
        auto* textFileparser = m_selectFileList.takeFirst(); // 获取第一个txt类型数据解析类对象并移除

        QVector<QVector<double>> keyList = textFileparser->getEachColDataOfKey();
        QVector<QVector<double>> otherKeyData;
        if (m_2DPlotType == FileDataType::FileTwoDHeatMap)
        {
            if (!chosenData.isEmpty())
            {
                textFileparser->setSecondScanParameterIndex(chosenData.first().first);
                chosenData.removeFirst();
            }
            else
            {
                s_infoList.clear();
                emit IBaseSignalInstance->signal_sendErrorMessageToUI("无足够数据变量，请重新选择工程文件");
                *isSuccess = _isSuccess;
                return;
            }
        }
        int _curveNum = 1; // 显示曲线的数量，用于进度显示
        for (auto i : chosenData)
        {
            _curveNum *= i.second.count();
        }
        _curveNum *= valueIndexs.count();
        if (_curveNum > 30)
        {
            UpdateStatusBarInformation(QStringLiteral("操作进行中..."), true);
        }
        for (const auto& i : chosenData)
        {
            QVector<double> singleColmValue;
            for (auto j : i.second)
            {
                singleColmValue.append(keyList[i.first][j]);
            }
            otherKeyData.append(singleColmValue);
        }
        //qDebug() << "variableIndex = " << variableIndex
        //         << " \n chosenData = " << chosenData
        //         << " \n valueIndexs = " << valueIndexs;
        textFileparser->setScanParameterIndex(variableIndex);
        textFileparser->setOtherKeyParameter(otherKeyData);

        QList<Info2DPointer> infoList;
        QList<QPair<int, int>> tempList;
        for (auto i : valueIndexs)
        {
            QPair<int, int> tem{i, 0};
            tempList.append(tem);
        }
        if (m_2DPlotType == FileDataType::FileTwoDHeatMap)
        {
            textFileparser->getChosenLinesFromMultiKey(tempList, infoList);
        }
        else
        {
            textFileparser->getChosenLinesFromKey(tempList, infoList);
        }
        QString sourcesStr;
        slot_getTwoDDataSources(textFileparser, sourcesStr);
        ResultDataPointer resultData;
        slot_getTwoDResultDataPointer(textFileparser, resultData);
        for (auto& info : infoList)
        {
            if (m_2DPlotType == FileDataType::File2DCurve)
            {
                info->setGraphType(GraphType::TwoDLineChart);
            }
            else if (m_2DPlotType == FileDataType::FilePolar)
            {
                info->setGraphType(GraphType::PolarGraph);
            }
            else if (m_2DPlotType == FileDataType::FileTwoDHeatMap)
            {
                info->setGraphType(GraphType::TwoDHeatMap);
            }
            info->setDataSources(sourcesStr);
            // 设置item
            auto items = m_centerWidget->getSelectedItems();
            if (!items.isEmpty())
                info->setProjectTreeSourceItem(items.at(0));
            if (!resultData.isNull() && !resultData->mulitFileInfo.second.isEmpty())
            {
                const auto& pair = resultData->mulitFileInfo.first;
                info->setFieldType(pair.first);
                info->setUnit(pair.second);
                QList<double> varValueList;
                for (const auto& tmpPair : resultData->mulitFileInfo.second)
                {
                    varValueList.append(tmpPair.first);
                }
                info->setVarValueList(varValueList);
            }
        }
        s_infoList.append(std::move(infoList));

        // Graph2D* newGraph = m_centerWidget->addNewGraph2D();
        // m_centerWidget->setCurrentTab(newGraph);
        // QPair<QString, QVector<double>> tempx;

        // for (InfomationCurve2DBasical& i : infoList)
        //{
        //     i.setGraph(newGraph);
        //     m_centerWidget->addLineToGrapg2D(i);
        // }
        // 所有文件都选择完毕
        if (m_selectFileList.isEmpty())
        {
            if (m_2DPlotType == FileDataType::File2DCurve)
            {
                m_centerWidget->addImageToNewGrapg2DWindow(s_infoList, isOpenNewWindow);
            }
            else if (m_2DPlotType == FileDataType::FilePolar)
            {
                m_centerWidget->addImageToNewGrapg2DWindow(s_infoList, isOpenNewWindow);
            }
            else if (m_2DPlotType == FileDataType::FileTwoDHeatMap)
            {
                for (const auto& info : s_infoList)
                {
                    QList<Info2DPointer> tmpList;
                    tmpList.append(info);
                    m_centerWidget->addImageToNewGrapg2DWindow(tmpList, isOpenNewWindow);
                }
            }
            if (_curveNum > 30)
            {
                UpdateStatusBarInformation(QStringLiteral("操作完成！"), false);
            }
            //m_openNewWindow = true;
            s_infoList.clear();
            m_optionalKeyList.clear();
        }
        else
        {
            if (!isRun)
            {
                // 多文件的后续选择同步第一个选择的key
                if (m_optionalKeyList.size() > 1)
                {
                    m_optionalKeyList = {textFileparser->getEachColNameOfKey().at(variableIndex).toLower()};
                }
                ShowSelecetDataDialog();
            }
        }
        *isSuccess = true;
    }

    void MainWindow::solt_set2DPlotType(int type)
    {
        m_2DPlotType = FileDataType(type);
    }

    void MainWindow::slot_sendQuestionMessageToUI(int& result, const QString& title, const QString& message)
    {
        EDialogMsgResult _result = IdaDialogMsg::showDialog(this, message, EDialogMsg::Question, title);
        result = (int)_result;

        // QMessageBox::StandardButton _result = QMessageBox::question(this, title, message, QMessageBox::Yes | QMessageBox::No);
        // if (result == QMessageBox::Yes)
        //{
        //     result = 1;
        // }
        // else
        //{
        //     result = 0;
        // }
    }

    void MainWindow::slot_sendErrorMessageToUI(const QString& message)
    {
        EDialogMsgResult _result = IdaDialogMsg::showDialog(this, message, EDialogMsg::Error, QStringLiteral("错误"));

        // QMessageBox::critical(this, QStringLiteral("错误"), message);
    }

    void MainWindow::slot_addToCurrentGraph(const QList<QStandardItem*>& index)
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        //  添加到当前图：只允许二维折线、极坐标、三维云图、三维曲面图
        if (qobject_cast<LineChartWindow*>(currentGraph) != nullptr && m_toolButton2DGraph->isEnabled())
        {

            m_2DPlotType = FileDataType::File2DCurve;
            slot_displayNew2DGraph(false);
        }
        else if (qobject_cast<PolarCoordinateGraphWindow*>(currentGraph) != nullptr && m_toolButtonPolarGraph->isEnabled())
        {
            m_2DPlotType = FileDataType::FilePolar;
            slot_displayNew2DGraph(false);
        }
        else if (qobject_cast<ThreeDCloudMapWindow*>(currentGraph) != nullptr && m_toolButton3DCloudMap->isEnabled())
        {
            slot_displayNewThreeDCloudMap(false);
        }
        else if (qobject_cast<ThreeDSurfacePlotWindow*>(currentGraph) != nullptr && m_toolButton3DSurfacePlot->isEnabled())
        {
            slot_displayNewThreeDSurfacePlot(false);
        }
        else
        {
            IBaseSignalInstance->signal_sendErrorMessageToUI("不允许添加该类型数据到当前图");
            return;
        }
    }

    void MainWindow::slot_tabBarCurrentChanged()
    {
        bool _isShouldEnableDataAnimation = false; // 二维热力图和三维图
        auto _currentType = currentWindowTypeRecognize(_isShouldEnableDataAnimation);

        { // 所有窗口切换先关闭clipper激活状态
            QSignalBlocker blocker(m_toolButtonActiveClipper);
            m_toolButtonActiveClipper->setChecked(false);
        }

        if (_currentType == CurrentWindowType::TwoDGraph)
        {
            m_toolButtonFormatView->setEnabled(true);         // 标准显示
            m_labelStandardSelection->setEnabled(true);       // 标准选择
            m_comboBoxStandardSelection->setEnabled(true);    // 标准选择
            m_labelDataSelection->setEnabled(true);           // 数据选择
            m_comboBoxDataSelection->setEnabled(true);        // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(true); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(true); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(true);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(true); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(true);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(true); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);        // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(true);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(true);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(true);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(true);        // 插值
            m_toolButtonMeasure->setEnabled(true);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(true); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(true);       // 半波功率波束宽度
            m_MaxValue->setEnabled(true);                       // 最大值
            m_MinValue->setEnabled(true);                       // 最小值
            m_AverageValue->setEnabled(true);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(true);    // 平移
            m_toolButtonRotation->setEnabled(false);      // 旋转
            m_toolButtonIsometricView->setEnabled(false); // 等距视图
            m_toolButtonTopView->setEnabled(false);       // 俯视图
            m_toolButtonUpwardView->setEnabled(false);    // 仰视图
            m_toolButtonFrontView->setEnabled(false);     // 正视图
            m_toolButtonRearView->setEnabled(false);      // 后视图
            m_toolButtonLeftView->setEnabled(false);      // 左视图
            m_toolButtonRightView->setEnabled(false);     // 右视图
            m_toolButtonModelDisplay->setEnabled(false);  // 模型显示
            m_toolButtonActiveClipper->setEnabled(false); // 剖面
            m_labelNormal->setEnabled(false);             // 法向
            m_labelLocation->setEnabled(false);           // 位置
            m_labelLocationUnit->setEnabled(false);       // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);   // 法向
            m_lineEditClipperOrigin->setEnabled(false);   // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(false);          // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图

            auto currentGraph = qobject_cast<LineChartWindow*>(m_centerWidget->getCurrentGraphWindow());
            currentGraph->slot_updateSelectedGraphState();
            currentGraph->slot_checkStandardCcurveState();
        }
        else if (_currentType == CurrentWindowType::PolarGraph)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(true);               // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(true);        // 半波功率波束宽度
            m_MaxValue->setEnabled(true);                        // 最大值
            m_MinValue->setEnabled(true);                        // 最小值
            m_AverageValue->setEnabled(true);                    // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(false);   // 平移
            m_toolButtonRotation->setEnabled(false);      // 旋转
            m_toolButtonIsometricView->setEnabled(false); // 等距视图
            m_toolButtonTopView->setEnabled(false);       // 俯视图
            m_toolButtonUpwardView->setEnabled(false);    // 仰视图
            m_toolButtonFrontView->setEnabled(false);     // 正视图
            m_toolButtonRearView->setEnabled(false);      // 后视图
            m_toolButtonLeftView->setEnabled(false);      // 左视图
            m_toolButtonRightView->setEnabled(false);     // 右视图
            m_toolButtonModelDisplay->setEnabled(false);  // 模型显示
            m_toolButtonActiveClipper->setEnabled(false); // 剖面
            m_labelNormal->setEnabled(false);             // 法向
            m_labelLocation->setEnabled(false);           // 位置
            m_labelLocationUnit->setEnabled(false);       // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);   // 法向
            m_lineEditClipperOrigin->setEnabled(false);   // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(false);          // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图

            auto currentGraph = qobject_cast<PolarCoordinateGraphWindow*>(m_centerWidget->getCurrentGraphWindow());
            currentGraph->slot_updateSelectedGraphState();
            m_toolButtonCurveSmoothing->setEnabled(false); // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);  // 插值
        }
        else if (_currentType == CurrentWindowType::TwoDHeatMap)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(true);    // 平移
            m_toolButtonRotation->setEnabled(false);      // 旋转
            m_toolButtonIsometricView->setEnabled(false); // 等距视图
            m_toolButtonTopView->setEnabled(false);       // 俯视图
            m_toolButtonUpwardView->setEnabled(false);    // 仰视图
            m_toolButtonFrontView->setEnabled(false);     // 正视图
            m_toolButtonRearView->setEnabled(false);      // 后视图
            m_toolButtonLeftView->setEnabled(false);      // 左视图
            m_toolButtonRightView->setEnabled(false);     // 右视图
            m_toolButtonModelDisplay->setEnabled(false);  // 模型显示
            m_toolButtonActiveClipper->setEnabled(false); // 剖面
            m_labelNormal->setEnabled(false);             // 法向
            m_labelLocation->setEnabled(false);           // 位置
            m_labelLocationUnit->setEnabled(false);       // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);   // 法向
            m_lineEditClipperOrigin->setEnabled(false);   // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(true);           // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(true);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(true); // 动画信息栏右部分
            m_SubtractSliderPushButton->setEnabled(false);
            m_sliderAniamtionInfoPosition->setEnabled(false);
            m_AdditionSliderPushButton->setEnabled(false);

            m_toolButtonDynamicType->setEnabled(true);       // 类型：相机
            m_actionCamera->setEnabled(false);               // 类型：相机
            m_actionData->setEnabled(true);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(true);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(true); // 导出动图
        }
        else if (_currentType == CurrentWindowType::ThreeDCloudMap)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(true);    // 平移
            m_toolButtonRotation->setEnabled(true);       // 旋转
            m_toolButtonIsometricView->setEnabled(true);  // 等距视图
            m_toolButtonTopView->setEnabled(true);        // 俯视图
            m_toolButtonUpwardView->setEnabled(true);     // 仰视图
            m_toolButtonFrontView->setEnabled(true);      // 正视图
            m_toolButtonRearView->setEnabled(true);       // 后视图
            m_toolButtonLeftView->setEnabled(true);       // 左视图
            m_toolButtonRightView->setEnabled(true);      // 右视图
            m_toolButtonModelDisplay->setEnabled(true);   // 模型显示
            m_toolButtonActiveClipper->setEnabled(true);  // 剖面
            m_labelNormal->setEnabled(true);              // 法向
            m_labelLocation->setEnabled(true);            // 位置
            m_labelLocationUnit->setEnabled(true);        // 位置单位
            m_comboBoxClipperNormal->setEnabled(true);    // 法向
            m_lineEditClipperOrigin->setEnabled(true);    // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(true);           // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(true);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(true); // 动画信息栏右部分
            m_SubtractSliderPushButton->setEnabled(false);
            m_sliderAniamtionInfoPosition->setEnabled(false);
            m_AdditionSliderPushButton->setEnabled(false);

            m_toolButtonDynamicType->setEnabled(true);       // 类型：相机
            m_actionCamera->setEnabled(true);                // 类型：相机
            m_actionData->setEnabled(true);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(true);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(true); // 导出动图

            updateCipperUI();
        }
        else if (_currentType == CurrentWindowType::ThreeDSurfacePlot)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(true);    // 平移
            m_toolButtonRotation->setEnabled(true);       // 旋转
            m_toolButtonIsometricView->setEnabled(true);  // 等距视图
            m_toolButtonTopView->setEnabled(true);        // 俯视图
            m_toolButtonUpwardView->setEnabled(true);     // 仰视图
            m_toolButtonFrontView->setEnabled(true);      // 正视图
            m_toolButtonRearView->setEnabled(true);       // 后视图
            m_toolButtonLeftView->setEnabled(true);       // 左视图
            m_toolButtonRightView->setEnabled(true);      // 右视图
            m_toolButtonModelDisplay->setEnabled(true);   // 模型显示
            m_toolButtonActiveClipper->setEnabled(true);  // 剖面
            m_labelNormal->setEnabled(true);              // 法向
            m_labelLocation->setEnabled(true);            // 位置
            m_labelLocationUnit->setEnabled(true);        // 位置单位
            m_comboBoxClipperNormal->setEnabled(true);    // 法向
            m_lineEditClipperOrigin->setEnabled(true);    // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(true);           // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(true);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(true); // 动画信息栏右部分
            m_SubtractSliderPushButton->setEnabled(false);
            m_sliderAniamtionInfoPosition->setEnabled(false);
            m_AdditionSliderPushButton->setEnabled(false);

            m_toolButtonDynamicType->setEnabled(true);       // 类型：相机
            m_actionCamera->setEnabled(true);                // 类型：相机
            m_actionData->setEnabled(true);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(true);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(true); // 导出动图

            updateCipperUI();
        }
        else if (_currentType == CurrentWindowType::SurfaceElectricFieldMap)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(true);          // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(true); // 自适应
            m_toolButtonAmplify->setEnabled(true);        // 放大
            m_toolButtonMinification->setEnabled(true);   // 缩小
            m_toolButtonTranslation->setEnabled(true);    // 平移
            m_toolButtonRotation->setEnabled(true);       // 旋转
            m_toolButtonIsometricView->setEnabled(true);  // 等距视图
            m_toolButtonTopView->setEnabled(true);        // 俯视图
            m_toolButtonUpwardView->setEnabled(true);     // 仰视图
            m_toolButtonFrontView->setEnabled(true);      // 正视图
            m_toolButtonRearView->setEnabled(true);       // 后视图
            m_toolButtonLeftView->setEnabled(true);       // 左视图
            m_toolButtonRightView->setEnabled(true);      // 右视图
            m_toolButtonModelDisplay->setEnabled(true);   // 模型显示
            m_toolButtonActiveClipper->setEnabled(true);  // 剖面
            m_labelNormal->setEnabled(true);              // 法向
            m_labelLocation->setEnabled(true);            // 位置
            m_labelLocationUnit->setEnabled(true);        // 位置单位
            m_comboBoxClipperNormal->setEnabled(true);    // 法向
            m_lineEditClipperOrigin->setEnabled(true);    // 位置
            m_toolButtonFastBack->setEnabled(false);      // 快退
            m_toolButtonPlay->setEnabled(true);           // 播放
            m_toolButtonFastForward->setEnabled(false);   // 快进

            m_animationInfoBarWidgetLeft->setEnabled(true);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(true); // 动画信息栏右部分
            m_SubtractSliderPushButton->setEnabled(false);
            m_sliderAniamtionInfoPosition->setEnabled(false);
            m_AdditionSliderPushButton->setEnabled(false);

            m_toolButtonDynamicType->setEnabled(true);       // 类型：相机
            m_actionCamera->setEnabled(true);                // 类型：相机
            m_actionData->setEnabled(true);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(true);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(true); // 导出动图

            updateCipperUI();
        }
        else if (_currentType == CurrentWindowType::DataTable)
        {
            m_toolButtonFormatView->setEnabled(false);        // 标准显示
            m_labelStandardSelection->setEnabled(false);      // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);   // 标准选择
            m_labelDataSelection->setEnabled(false);          // 数据选择
            m_comboBoxDataSelection->setEnabled(false);       // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(true); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(true);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(false); // 自适应
            m_toolButtonAmplify->setEnabled(false);        // 放大
            m_toolButtonMinification->setEnabled(false);   // 缩小
            m_toolButtonTranslation->setEnabled(false);    // 平移
            m_toolButtonRotation->setEnabled(false);       // 旋转
            m_toolButtonIsometricView->setEnabled(false);  // 等距视图
            m_toolButtonTopView->setEnabled(false);        // 俯视图
            m_toolButtonUpwardView->setEnabled(false);     // 仰视图
            m_toolButtonFrontView->setEnabled(false);      // 正视图
            m_toolButtonRearView->setEnabled(false);       // 后视图
            m_toolButtonLeftView->setEnabled(false);       // 左视图
            m_toolButtonRightView->setEnabled(false);      // 右视图
            m_toolButtonModelDisplay->setEnabled(false);   // 模型显示
            m_toolButtonActiveClipper->setEnabled(false);  // 剖面
            m_labelNormal->setEnabled(false);              // 法向
            m_labelLocation->setEnabled(false);            // 位置
            m_labelLocationUnit->setEnabled(false);        // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);    // 法向
            m_lineEditClipperOrigin->setEnabled(false);    // 位置
            m_toolButtonFastBack->setEnabled(false);       // 快退
            m_toolButtonPlay->setEnabled(false);           // 播放
            m_toolButtonFastForward->setEnabled(false);    // 快进

            m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图
        }
        else
        {
            m_toolButtonFormatView->setEnabled(false);         // 标准显示
            m_labelStandardSelection->setEnabled(false);       // 标准选择
            m_comboBoxStandardSelection->setEnabled(false);    // 标准选择
            m_labelDataSelection->setEnabled(false);           // 数据选择
            m_comboBoxDataSelection->setEnabled(false);        // 数据选择
            m_toolButtonScreenshotToReport->setEnabled(false); // 截图至报告
            m_toolButtonSaveImageToLocal->setEnabled(false);   // 保存图片

            // 数据分析按钮
            // m_toolButtonTotalQuantityCalculation->setEnabled(false); // 总量计算
            m_toolButtonHirfExtrapolation->setEnabled(false); // HIRF外推
            // m_toolButtonFieldTransferFunction->setEnabled(false);   // 场传递函数
            // m_toolButtonCurrentTransferFunction->setEnabled(false); // 电流传递函数
            m_toolButtonIPLCalculation->setEnabled(false);   // IPL计算
            m_toolButtonWaveformAnalysis->setEnabled(false); // 波形分析
            // m_toolButtonLightningZoning->setEnabled(false);         // 雷电分区
            m_toolButtonShieldingEfficiency->setEnabled(false);  // 屏蔽效能
            m_toolButtonTransferFunction->setEnabled(false);     // 传递函数
            m_toolButtonCurveSmoothing->setEnabled(false);       // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);        // 插值
            m_toolButtonMeasure->setEnabled(false);              // 测量
            //m_toolButtonEvaluationSubmission->setEnabled(false); // 评估提交
            m_actionHalfPowerBeamWidth->setEnabled(false);       // 半波功率波束宽度
            m_MaxValue->setEnabled(false);                       // 最大值
            m_MinValue->setEnabled(false);                       // 最小值
            m_AverageValue->setEnabled(false);                   // 平均值

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(false); // 自适应
            m_toolButtonAmplify->setEnabled(false);        // 放大
            m_toolButtonMinification->setEnabled(false);   // 缩小
            m_toolButtonTranslation->setEnabled(false);    // 平移
            m_toolButtonRotation->setEnabled(false);       // 旋转
            m_toolButtonIsometricView->setEnabled(false);  // 等距视图
            m_toolButtonTopView->setEnabled(false);        // 俯视图
            m_toolButtonUpwardView->setEnabled(false);     // 仰视图
            m_toolButtonFrontView->setEnabled(false);      // 正视图
            m_toolButtonRearView->setEnabled(false);       // 后视图
            m_toolButtonLeftView->setEnabled(false);       // 左视图
            m_toolButtonRightView->setEnabled(false);      // 右视图
            m_toolButtonModelDisplay->setEnabled(false);   // 模型显示
            m_toolButtonActiveClipper->setEnabled(false);  // 剖面
            m_labelNormal->setEnabled(false);              // 法向
            m_labelLocation->setEnabled(false);            // 位置
            m_labelLocationUnit->setEnabled(false);        // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);    // 法向
            m_lineEditClipperOrigin->setEnabled(false);    // 位置
            m_toolButtonFastBack->setEnabled(false);       // 快退
            m_toolButtonPlay->setEnabled(false);           // 播放
            m_toolButtonFastForward->setEnabled(false);    // 快进

            m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图
        }

        // 设置动图模块属性
        if (_currentType == CurrentWindowType::SurfaceElectricFieldMap || _currentType == CurrentWindowType::ThreeDSurfacePlot || _currentType == CurrentWindowType::ThreeDCloudMap)
        {
            auto window = qobject_cast<Graph3DWindowBase*>(m_centerWidget->getCurrentGraphWindow());
            if (window == nullptr)
            {
                return;
            }
            auto type = window->getAnimationType();
            QString text = type == 1 ? "类型：相机" : "类型：数据";
            if (type == 1)
            {
                m_menuSignalHandlerInstance->setIsDynamicTypeCamera(true);
            }
            updateAnimationButtonState();

            m_toolButtonDynamicType->setText(text);
            if (m_toolButtonActiveClipper->isChecked())
            {
                m_toolButtonFastBack->setEnabled(false);    // 快退
                m_toolButtonPlay->setEnabled(false);        // 播放
                m_toolButtonFastForward->setEnabled(false); // 快进

                m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
                m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

                m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
                m_actionCamera->setEnabled(false);                // 类型：相机
                m_actionData->setEnabled(false);                  // 类型：相机
                m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
                m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图
            }

            // 动图信息
            auto AnimationTooBarInfoData = window->getAnimationTooBarInfoData();
            if (AnimationTooBarInfoData != nullptr)
            {
                auto aniType = AnimationTooBarInfoData->getType();
                auto aniUnit = AnimationTooBarInfoData->getUnit();
                auto aniValue = AnimationTooBarInfoData->getCurrentValue();
                auto aniSliderValue = AnimationTooBarInfoData->getSliderCurrentValue();
                auto aniSliderMax = AnimationTooBarInfoData->getSliderMaxValue();
                m_labelAniamtionInfoTypeValue->setText(aniType);
                m_labelAniamtionInfoValueValue->setText(aniValue);
                m_labelAniamtionInfoUnitValue->setText(aniUnit);
                m_sliderAniamtionInfoPosition->setMaximum(aniSliderMax - 1);
                m_sliderAniamtionInfoPosition->setValue(aniSliderValue);
            }
        }
        else if (_currentType == CurrentWindowType::TwoDHeatMap)
        {
            auto window = qobject_cast<HeatMapWindow*>(m_centerWidget->getCurrentGraphWindow());
            if (window == nullptr)
            {
                return;
            }
            m_toolButtonDynamicType->setText("类型：数据"); // 热力图只有数据
            updateAnimationButtonState();

            // 动图信息
            auto AnimationTooBarInfoData = window->getAnimationTooBarInfoData();
            if (AnimationTooBarInfoData != nullptr)
            {
                auto aniType = AnimationTooBarInfoData->getType();
                auto aniUnit = AnimationTooBarInfoData->getUnit();
                auto aniValue = AnimationTooBarInfoData->getCurrentValue();
                auto aniSliderValue = AnimationTooBarInfoData->getSliderCurrentValue();
                auto aniSliderMax = AnimationTooBarInfoData->getSliderMaxValue();
                m_labelAniamtionInfoTypeValue->setText(aniType);
                m_labelAniamtionInfoValueValue->setText(aniValue);
                m_labelAniamtionInfoUnitValue->setText(aniUnit);
                m_sliderAniamtionInfoPosition->setMaximum(aniSliderMax - 1);
                m_sliderAniamtionInfoPosition->setValue(aniSliderValue);
            }
        }

        slot_updateThunderstormZoneButtonState();

        // 显示模型按钮
        if (_currentType == CurrentWindowType::SurfaceElectricFieldMap || _currentType == CurrentWindowType::ThreeDSurfacePlot || _currentType == CurrentWindowType::ThreeDCloudMap)
        {
            auto window = qobject_cast<Graph3DWindowBase*>(m_centerWidget->getCurrentGraphWindow());
            if (window == nullptr)
            {
                return;
            }
            auto isSHowModel = window->getIsShowGeometryActors();
            m_toolButtonModelDisplay->setChecked(isSHowModel);
        }
        else
        {
            m_toolButtonModelDisplay->setChecked(false);
        }
    }

    void MainWindow::slot_getTwoDResultDataPointer(const TextFileParser* textFIleParser, ResultDataPointer& resultDataPointer)
    {
        QStandardItem* item = nullptr;
        for (auto iter = m_txtReader.begin(); iter != m_txtReader.end(); ++iter)
        {
            if (iter.value() == textFIleParser)
            {
                item = iter.key();
                break;
            }
        }
        if (item != nullptr)
        {
            if (m_fileType.contains(item))
            {
                resultDataPointer = m_fileType.value(item);
            }
        }
    }

    void MainWindow::slot_getTwoDDataSources(const TextFileParser* textFIleParser, QString& sourcesStr)
    {
        QStandardItem* item = nullptr;
        for (auto iter = m_txtReader.begin(); iter != m_txtReader.end(); ++iter)
        {
            if (iter.value() == textFIleParser)
            {
                item = iter.key();
                break;
            }
        }
        if (item != nullptr)
        {
            sourcesStr = item->text();
            QStandardItem* parentItem = item->parent();
            while (parentItem != nullptr)
            {
                sourcesStr.insert(0, parentItem->text() + "/");
                parentItem = parentItem->parent();
            }
        }
    }

    void MainWindow::slot_getThreeDDataSources(const void* reader, QString& sourcesStr)
    {
        auto func = [this](const auto& readerHash, const void* reader)
        {
            QStandardItem* item = nullptr;
            for (auto iter = readerHash.begin(); iter != readerHash.end(); ++iter)
            {
                if (iter.value() == reader)
                {
                    item = iter.key();
                    break;
                }
            }
            return item;
        };
        QStandardItem* item = func(m_vtkReader, reader);
        if (item == nullptr)
        {
            item = func(m_vtuReader, reader);
            if (item == nullptr)
            {
                item = func(m_vtpReader, reader);
            }
        }
        if (item != nullptr)
        {
            sourcesStr = item->text();
            QStandardItem* parentItem = item->parent();
            while (parentItem != nullptr)
            {
                sourcesStr.insert(0, parentItem->text() + "/");
                parentItem = parentItem->parent();
            }
        }
    }

    void MainWindow::slot_measureButtonStateChanged(int state)
    {
        if (state == 0)
        {
            m_toolButtonCurveSmoothing->setEnabled(false); // 曲线平滑
            m_toolButtonInterpolation->setEnabled(false);  // 插值
            m_toolButtonMeasure->setEnabled(false);        // 测量
        }
        else
        {
            auto currentGraph = m_centerWidget->getCurrentGraphWindow();
            if (qobject_cast<PolarCoordinateGraphWindow*>(currentGraph) == nullptr) // 极坐标图
            {
                m_toolButtonCurveSmoothing->setEnabled(true); // 曲线平滑
                m_toolButtonInterpolation->setEnabled(true);  // 插值
            }
            m_toolButtonMeasure->setEnabled(true); // 测量
            if (state == 1)
            {
                m_actionHalfPowerBeamWidth->setEnabled(false); // 半波功率波束宽度
                m_standingWaveBandwidth->setEnabled(false);    // 半波功率波束宽度
            }
            else if (state == 2)
            {
                m_actionHalfPowerBeamWidth->setEnabled(true); // 半波功率波束宽度
                m_standingWaveBandwidth->setEnabled(false);   // 半波功率波束宽度
            }
            else if (state == 3)
            {
                m_actionHalfPowerBeamWidth->setEnabled(false); // 半波功率波束宽度
                m_standingWaveBandwidth->setEnabled(true);     // 半波功率波束宽度
            }
        }
    }

    void MainWindow::slot_standardCcurveButtonSctateChanged(bool state)
    {
        bool _temp;
        auto _type = currentWindowTypeRecognize(_temp);
        if (_type == CurrentWindowType::TwoDGraph)

        {
            m_toolButtonFormatView->setEnabled(state);      // 标准显示
            m_labelStandardSelection->setEnabled(state);    // 标准选择
            m_comboBoxStandardSelection->setEnabled(state); // 标准选择
            m_labelDataSelection->setEnabled(state);        // 数据选择
            m_comboBoxDataSelection->setEnabled(state);     // 数据选择
        }
    }

    void MainWindow::slot_setEnableAnimationBtn(bool enable)
    {
        m_toolButtonPlay->setEnabled(enable);
        m_toolButtonExportMotionGraph->setEnabled(enable);

        m_animationInfoBarWidgetLeft->setEnabled(enable);  // 动画信息栏左部分
        m_animationInfoBarWidgetRight->setEnabled(enable); // 动画信息栏右部分
    }

    void MainWindow::updateAnimationButtonState()
    {
        slot_updateAnimationButtonState();
    }

    TextFileParser* MainWindow::getTextFileParserByProjectTreeItem(int projectTreeItemID)
    {
        for (auto iter = m_txtReader.begin(); iter != m_txtReader.end(); ++iter)
        {
            if (iter.key()->data(Qt::UserRole + 10).toInt() == projectTreeItemID)
            {
                return iter.value();
            }
        }
        return nullptr;
    }

    TextFileParser* MainWindow::getTextFileParserByDataSourceByOpenProject(QString dataSources)
    {
        for (auto _parser : m_standardExampleData)
        {
            auto _fileName = _parser->GetFileName().split('/').last();
            if (_fileName == dataSources)
                return _parser;
        }
        return nullptr;
    }

    InfomationGraph3DBasical* MainWindow::BuildCompleteGraph3DInfoByProjectTreeItemThreeDCloudMap(int projectTreeItemID)
    {
        auto item = ProjectTreeDataInstance->getProjectTreeItemByID(projectTreeItemID);
        auto it = m_txtReader.find(item);
        if (it != m_txtReader.end())
        {
            m_selectFileList.append(it.value());

            auto& textFileParser = it.value();

            InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);

            PoseSettingData* poseSettingData = new PoseSettingData(this);
            const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
            if (!resultFileInfo.isNull())
            {
                const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                poseSettingData->setTranslationX(Antenna_position.position_X);
                poseSettingData->setTranslationY(Antenna_position.position_Y);
                poseSettingData->setTranslationX(Antenna_position.position_Z);
                poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                info->m_resultType = resultFileInfo.toStrongRef()->result_type;
            }
            info->m_poseSettingData = poseSettingData;
            info->m_geometryFileName = textFileParser->GetGeometryFileName();

            info->m_reader = textFileParser;
            info->readerIndex = m_pyTextParserList.indexOf(textFileParser);
            info->m_graphType = GraphType::ThreeDCloudMap;
            info->m_filePath = textFileParser->GetFileName();
            info->m_name = item->text();
            info->m_resultData = m_fileType[item];
            info->resultDataIndex = m_pyFileTypeList.indexOf(info->m_resultData);
            QString sourceStr;
            slot_getTwoDDataSources(textFileParser, sourceStr);
            info->m_dataSources = sourceStr;
            info->m_projectTreeSourceItem = item;
            const auto& resultData = m_fileType.value(item);
            if (!resultData->mulitFileInfo.second.isEmpty())
            {
                const auto& pair = resultData->mulitFileInfo.first;
                info->m_fieldType = pair.first;
                info->m_unit = pair.second;
                for (const auto& tmpPair : resultData->mulitFileInfo.second)
                {
                    info->m_VarValueList.append(tmpPair.first);
                }
            }
            return info;
        }
        return nullptr;
    }
    InfomationGraph3DBasical* MainWindow::BuildCompleteGraph3DInfoByProjectTreeItemThreeDSurfacePlot( int projectTreeItemID)
    {
        auto item = ProjectTreeDataInstance->getProjectTreeItemByID(projectTreeItemID);
        auto it = m_txtReader.find(item);
        if (it != m_txtReader.end())
        {
            m_selectFileList.append(it.value());
            auto& textFileParser = it.value();
            auto table = textFileParser->getStandardTable();
            FarFieldDataGenerator* farFieldGenerator = new FarFieldDataGenerator(this);
            m_farFieldDataGeneratorList.append(farFieldGenerator);
            farFieldGenerator->setFileDealType(textFileParser->getFileDealType());
            farFieldGenerator->setInputData(table);

            QString errorMsg;
            bool isOk = farFieldGenerator->parseData(errorMsg);
            if (!isOk)
            {
                qDebug() << " FarFieldDataGenerator update failed!";
                return nullptr;
            }
            auto freList = farFieldGenerator->getFreqencyList();
            auto valueNameList = textFileParser->getEachColGroupNameOfValue();

            if (freList.isEmpty() || valueNameList.isEmpty())
            {
                qDebug() << " FarFieldDataGenerator update failed!";
                return nullptr;
            }
            InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
            PoseSettingData* poseSettingData = new PoseSettingData(this);
            const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
            if (!resultFileInfo.isNull())
            {
                const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                poseSettingData->setTranslationX(Antenna_position.position_X);
                poseSettingData->setTranslationY(Antenna_position.position_Y);
                poseSettingData->setTranslationZ(Antenna_position.position_Z);
                poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                info->m_resultType = resultFileInfo.toStrongRef()->result_type;
            }
            info->m_poseSettingData = poseSettingData;
            info->m_geometryFileName = textFileParser->GetGeometryFileName();
            info->m_reader = textFileParser; // *
            info->readerIndex = m_pyTextParserList.indexOf(textFileParser);
            info->m_filePath = textFileParser->GetFileName();  // QString
            info->m_name = item->text();                       // QString
            info->m_graphType = GraphType::ThreeDSurfacePlot;  // int
            info->m_farFieldDataGenerator = farFieldGenerator; // *
            QString sourceStr;
            slot_getTwoDDataSources(textFileParser, sourceStr);
            info->m_dataSources = sourceStr;
            info->m_projectTreeSourceItem = item;
            const auto& resultData = m_fileType.value(item);
            if (!resultData->mulitFileInfo.second.isEmpty())
            {
                const auto& pair = resultData->mulitFileInfo.first;
                info->m_fieldType = pair.first;
                info->m_unit = pair.second;
                for (const auto& tmpPair : resultData->mulitFileInfo.second)
                {
                    info->m_VarValueList.append(tmpPair.first);
                }
            }
            return info;
        }
        return nullptr;
    }
    InfomationGraph3DBasical* MainWindow::BuildCompleteGraph3DInfoByProjectTreeItemSurfaceElectricFieldMap(int projectTreeItemID)
    {
        auto item = ProjectTreeDataInstance->getProjectTreeItemByID(projectTreeItemID);
        auto it = m_fileType.find(item);
        if (it != m_fileType.end())
        {
            InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
            PoseSettingData* poseSettingData = new PoseSettingData(this);
            const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
            if (!resultFileInfo.isNull())
            {
                const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                poseSettingData->setTranslationX(Antenna_position.position_X);
                poseSettingData->setTranslationY(Antenna_position.position_Y);
                poseSettingData->setTranslationX(Antenna_position.position_Z);
                poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                info->m_resultType = resultFileInfo.toStrongRef()->result_type;
            }
            info->m_poseSettingData = poseSettingData;
            if (m_vtuReader.contains(item)) // 判断是否是vtu格式
            {
                info->m_reader = m_vtuReader[item];
                info->readerIndex = m_pyVtuReaderList.indexOf(m_vtuReader[item]);
                info->readerType = "vtu";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtuReader[item]->GetFileName();
                info->m_data = m_vtuReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtuReader[item]->GetGeometryFileName();
            }
            else if (m_vtkReader.contains(item))
            {
                info->m_reader = m_vtkReader[item];
                info->readerIndex = m_pyVtkReaderList.indexOf(m_vtkReader[item]);
                info->readerType = "vtk";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtkReader[item]->GetFileName();
                info->m_data = m_vtkReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtkReader[item]->GetGeometryFileName();
            }
            else if (m_vtpReader.contains(item))
            {
                info->m_reader = m_vtpReader[item];
                info->readerIndex = m_pyVtpReaderList.indexOf(m_vtpReader[item]);
                info->readerType = "vtp";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtpReader[item]->GetFileName();
                info->m_data = m_vtpReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtpReader[item]->GetGeometryFileName();
            }
            else
            {
                return nullptr;
            }

            auto fieldGraphGenerator = new FieldGraphGenerator(this);
            fieldGraphGenerator->SetInputDataSet(info->m_data);
            auto pointArray = fieldGraphGenerator->GetPointsArrayIndexAndNames();
            auto cellArray = fieldGraphGenerator->GetCellsArrayIndexAndNames();
            info->m_allPointArray = pointArray;
            info->m_allCellArray = cellArray;
            info->m_fieldGraphGenerator = fieldGraphGenerator;
            QString sourceStr;
            slot_getThreeDDataSources(info->m_reader, sourceStr);
            info->m_dataSources = sourceStr;
            info->m_projectTreeSourceItem = item;
            const auto& resultData = m_fileType.value(item);
            if (!resultData->mulitFileInfo.second.isEmpty())
            {
                const auto& pair = resultData->mulitFileInfo.first;
                info->m_fieldType = pair.first;
                info->m_unit = pair.second;
                for (const auto& tmpPair : resultData->mulitFileInfo.second)
                {
                    info->m_VarValueList.append(tmpPair.first);
                }
            }
            return info;
        }
        return nullptr;
    }
    InfomationGraph3DBasical* MainWindow::BuildCompleteGraph3DInfoByProjectTreeItemTableChart(int projectTreeItemID)
    {
        auto item = ProjectTreeDataInstance->getProjectTreeItemByID(projectTreeItemID);
        auto _reader = m_txtReader.value(item);
        if (_reader == nullptr)
            return nullptr;
        InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
        info->m_reader = _reader;
        info->m_filePath = _reader->GetFileName();
        info->m_projectTreeSourceItem = item;
        QString sourcesStr;
        slot_getTwoDDataSources(_reader, sourcesStr);
        info->m_dataSources = sourcesStr;
        return info;
    }

    QList<QPair<QStandardItem*, QString>> MainWindow::GetAttachmentPointDatas(QStandardItem* currentGraphItem)
    {
        QList<QPair<QStandardItem*, QString>> attachmentPointDatas;
        auto item = currentGraphItem;
        while (item->parent() != nullptr)
        {
            item = item->parent();
        }
        auto leafsList = m_centerWidget->getLeafsByItem(item);
        for (auto itemTmp : leafsList)
        {
            if (m_fileType.contains(itemTmp))
            {
                auto infoPointer = m_fileType.value(itemTmp);
                const auto& resultFileInfo = infoPointer->resultFileInfo;
                if (resultFileInfo.isNull())
                {
                    continue;
                }
                else
                {
                    const auto& resultFileInfoPointer = resultFileInfo.toStrongRef();
                    if (resultFileInfoPointer->result_type == 14)
                    {
                        attachmentPointDatas.append(qMakePair(itemTmp, infoPointer->path));
                    }
                }
            }
        }
        return attachmentPointDatas;
    }

    void MainWindow::slot_updateAnimationButtonState()
    {
        auto currentWindow = m_centerWidget->getCurrentGraphWindow();
        if (currentWindow == nullptr)
        {
            return;
        }
        if (qobject_cast<HeatMapWindow*>(currentWindow) != nullptr) // 热力图
        {
            auto isCamera = qobject_cast<HeatMapWindow*>(currentWindow)->getAnimationType(); // 0:数据变化 1 : 相机变化
            if (isCamera)
            {
                slot_setEnableAnimationBtn(true);
            }
            else
            {
                auto canDataAni = qobject_cast<HeatMapWindow*>(currentWindow)->whetherCanEnableDataAnimation();
                slot_setEnableAnimationBtn(canDataAni);
            }
        }
        else if (qobject_cast<Graph3DWindowBase*>(currentWindow) != nullptr) // 三维图
        {
            // 先判断动图类型，是相机类型则直接设置可用。是数类型，则从窗口中获取是否数据类型动图可用
            auto isCamera = qobject_cast<Graph3DWindowBase*>(currentWindow)->getAnimationType(); // 0:数据变化 1 : 相机变化
            if (isCamera)
            {
                if (!m_toolButtonActiveClipper->isChecked())
                {
                    slot_setEnableAnimationBtn(true);
                }
            }
            else
            {
                auto canDataAni = qobject_cast<Graph3DWindowBase*>(currentWindow)->whetherCanEnableDataAnimation();
                slot_setEnableAnimationBtn(canDataAni && !m_toolButtonActiveClipper->isChecked());
            }
        }
        else // 其他窗口不允许动图
        {
            slot_setEnableAnimationBtn(false);
        }
    }

    void MainWindow::slot_updateThunderstormZoneButtonState()
    {
        // 雷电分区
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        if (qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph)) // 表面电场图
        {
            auto window = qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph);
            auto sourceItem = window->getSurfacePotentialDistributionSourceItem();
            if (sourceItem != nullptr)
            {
                m_toolButtonThunderstormZone->setEnabled(true);
            }
            else
            {
                m_toolButtonThunderstormZone->setEnabled(false);
            }
        }
        else
        {
            m_toolButtonThunderstormZone->setEnabled(false);
        }
    }

    void MainWindow::slot_setShowAnimationTextWidget(bool bShow)
    {
        // m_animationInfoBarWidget->setVisible(bShow);
    }

    void MainWindow::slot_setToolBarAnimationDataInfo(const QString& type,
                                                      const QString& unit, double currentValue, int totalNumber, int currentIndex)
    {
        m_labelAniamtionInfoTypeValue->setText(type);
        m_labelAniamtionInfoUnitValue->setText(unit);
        m_labelAniamtionInfoValueValue->setText(QString::number(currentValue));
        m_sliderAniamtionInfoPosition->setRange(0, totalNumber - 1);
        m_sliderAniamtionInfoPosition->setValue(currentIndex);
    }

    void MainWindow::slot_showImportProjectFirst(Ui::DialogImportProjectFirst* uiFirst, IdaDialogFrame* dialog, const QDir& targetDir)
    {
        auto func = [this](const QDir& targetDir, const QString& fileName, Ui::DialogImportProjectFirst* uiFirst, Ui::DialogImportProjectSecond* uiSecond, QLabel* label)
        {
            if (targetDir.exists(fileName))
            {
                QFile file(targetDir.absoluteFilePath(fileName));
                if (!file.open(QIODevice::ReadOnly))
                {
                    m_errorMessageList.append(fileName + " 打开失败");
                    return;
                }
                auto jsonText = file.readAll();
                file.close();
                QString modelPath;
                QJsonParseError jsonError;
                QJsonDocument jsonDocument = QJsonDocument::fromJson(jsonText, &jsonError);
                if (!jsonDocument.isNull() && (jsonError.error == QJsonParseError::NoError))
                {
                    if (jsonDocument.isObject())
                    {
                        QJsonObject jsonObject = jsonDocument.object();
                        bool isHasKey = true;
                        QString key = "inputDir";
                        if (!jsonObject.contains(key))
                        {
                            key = "InputDir";
                            if (!jsonObject.contains(key))
                            {
                                isHasKey = false;
                                m_errorMessageList.append(fileName + " 'inputDir'或'InputDir'字段不存在");
                            }
                        }
                        if (isHasKey)
                        {
                            if (!jsonObject.value(key).isArray())
                            {
                                m_errorMessageList.append(fileName + " " + key + "字段数据类型错误");
                            }
                            else
                            {
                                QStringList pathList;
                                QJsonArray inputDir = jsonObject.value(key).toArray();
                                for (int i = 0; i < inputDir.size(); ++i)
                                {
                                    const auto& jsonValue = inputDir.at(i);
                                    if (jsonValue.isString())
                                    {
                                        pathList.append(jsonValue.toString());
                                    }
                                    else
                                    {
                                        m_errorMessageList.append(QString::number(i) + "行不为string");
                                    }
                                }
                                if (!pathList.isEmpty())
                                {
                                    auto rootItem = new QTreeWidgetItem({label->text()});
                                    for (const auto& path : pathList)
                                    {
                                        auto item = new QTreeWidgetItem(rootItem, {QDir(path).dirName() + "(" + path + ")"});
                                        item->setData(0, Qt::UserRole, path);
                                        item->setCheckState(0, Qt::Checked);
                                    }
                                    uiSecond->treeWidget->addTopLevelItem(rootItem);
                                }
                            }
                        }
                    }
                    else
                    {
                        m_errorMessageList.append(fileName + " json不是object");
                    }
                }
                else
                {
                    m_errorMessageList.append(fileName + " json格式错误");
                }
            }
            else
            {
                m_errorMessageList.append(fileName + " 不存在");
            }
        };
        m_errorMessageList.clear();
        IdaDialogFrame* dialogSecond = new IdaDialogFrame(this);
        auto uiSecond = new Ui::DialogImportProjectSecond();
        uiSecond->setupUi(dialogSecond);
        if (uiFirst->checkBox_thunderbolt->isChecked())
        {
            func(targetDir, "lightning.json", uiFirst, uiSecond, uiFirst->label_thunderbolt);
        }
        if (uiFirst->checkBox_antenna->isChecked())
        {
            func(targetDir, "Antenna.json", uiFirst, uiSecond, uiFirst->label_antenna);
        }
        if (uiFirst->checkBox_HIRF->isChecked())
        {
            func(targetDir, "HIRF.json", uiFirst, uiSecond, uiFirst->label_HIRF);
        }
        if (uiFirst->checkBox_microwave->isChecked())
        {
            func(targetDir, "HPM.json", uiFirst, uiSecond, uiFirst->label_microwave);
        }
        if (uiFirst->checkBox_electrostatic->isChecked())
        {
            func(targetDir, "ESD.json", uiFirst, uiSecond, uiFirst->label_electrostatic);
        }
        if (uiFirst->checkBox_NEMP->isChecked())
        {
            func(targetDir, "HEMP.json", uiFirst, uiSecond, uiFirst->label_NEMP);
        }
        uiSecond->treeWidget->expandAll();
        IdaWidgetHelperInstance->setMainButtonStyle(uiSecond->pushButton_next); // 将确定设置为主按钮
        dialogSecond->setWindowTitle(tr("打开工程结果"));
        connect(uiSecond->pushButton_next, &QPushButton::clicked, [this, uiSecond, dialogSecond, dialog]()
                {
                for (int i = 0; i < uiSecond->treeWidget->topLevelItemCount(); ++i)
                {
                    auto topItem = uiSecond->treeWidget->topLevelItem(i);
                    for (int j = 0; j < topItem->childCount(); ++j)
                    {
                        auto item = topItem->child(j);
                        if (item->checkState(0) == Qt::Checked)
                        {
                            m_inputDirList.append(item->data(0, Qt::UserRole).toString());
                        }
                    }
                }
                dialog->closeWindow();
                dialogSecond->closeWindow(); });
        connect(uiSecond->pushButton_cancel, &QPushButton::clicked, [dialogSecond, dialog]()
                {
                dialog->closeWindow();
                dialogSecond->closeWindow(); });
        connect(uiSecond->pushButton, &QPushButton::clicked, [dialogSecond, dialog]()
                {
                dialogSecond->closeWindow();
                dialog->showWindowFrame(); });
        dialog->hideWindowFrame();
        if (uiSecond->treeWidget->topLevelItemCount() == 0)
        {
            dialogSecond->deleteLater();
            dialog->closeWindow();
        }
        else
        {
            dialogSecond->execWindow();
        }
    }

    CurrentWindowType MainWindow::currentWindowTypeRecognize(bool& isShouldEnableDataAnimation)
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        if (qobject_cast<LineChartWindow*>(currentGraph) != nullptr) // 二维折线图
        {
            return CurrentWindowType::TwoDGraph;
        }
        else if (qobject_cast<PolarCoordinateGraphWindow*>(currentGraph)) // 极坐标图
        {
            return CurrentWindowType::PolarGraph;
        }
        else if (qobject_cast<HeatMapWindow*>(currentGraph)) // 二维热力图
        {
            return CurrentWindowType::TwoDHeatMap;
        }
        else if (qobject_cast<ThreeDCloudMapWindow*>(currentGraph)) // 三维云图
        {
            isShouldEnableDataAnimation = qobject_cast<ThreeDCloudMapWindow*>(currentGraph)->whetherCanEnableDataAnimation();
            return CurrentWindowType::ThreeDCloudMap;
        }
        else if (qobject_cast<ThreeDSurfacePlotWindow*>(currentGraph)) // 三维曲面图
        {
            isShouldEnableDataAnimation = qobject_cast<ThreeDSurfacePlotWindow*>(currentGraph)->whetherCanEnableDataAnimation();
            return CurrentWindowType::ThreeDSurfacePlot;
        }
        else if (qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph)) // 表面电场图
        {
            isShouldEnableDataAnimation = qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph)->whetherCanEnableDataAnimation();
            return CurrentWindowType::SurfaceElectricFieldMap;
        }
        else if (qobject_cast<TableChatWindow*>(currentGraph)) // 数据表格
        {
            return CurrentWindowType::DataTable;
        }
        else
        {
            // 无图
            return CurrentWindowType::None;
        }
    }

    void MainWindow::slot_toolButtonThunderstormZoneClicked()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        if (!qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph)) // 表面电场图
        {
            return;
        }

        auto window = qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph);
        auto sourceItem = window->getSurfacePotentialDistributionSourceItem();
        if (sourceItem == nullptr)
        {
            return;
        }

        QList<QPair<QStandardItem*, QString>> thunderstormZoneData = this->GetAttachmentPointDatas(sourceItem);
        QList<QString> pathList;
        for (auto i : thunderstormZoneData)
        {
            QFileInfo fi(i.second);
            pathList.append(fi.baseName());
        }

        auto widget = new DialogSelectAttachmentPointPath(this);
        widget->setFilePaths(pathList);
        connect(widget, &DialogSelectAttachmentPointPath::signal_selectedAttachmentPointPathIndex, this, &MainWindow::slot_selectedAttachmentPointPathIndex);
        widget->showWindow();
    }

    void MainWindow::slot_selectedAttachmentPointPathIndex(int index)
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        if (!qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph)) // 表面电场图
        {
            return;
        }

        auto window = qobject_cast<SurfaceElectricFieldMapWindow*>(currentGraph);
        auto sourceItem = window->getSurfacePotentialDistributionSourceItem();
        if (sourceItem == nullptr)
        {
            return;
        }

        QList<QPair<QStandardItem*, QString>> thunderstormZoneData = this->GetAttachmentPointDatas(sourceItem);
        auto item = thunderstormZoneData[index].first;
        auto path = thunderstormZoneData[index].second;

        auto it = m_fileType.find(item);
        if (it != m_fileType.end())
        {
            InfomationGraph3DBasical* info = new InfomationGraph3DBasical(this);
            PoseSettingData* poseSettingData = new PoseSettingData(this);
            const auto& resultFileInfo = m_fileType.value(item)->resultFileInfo;
            if (!resultFileInfo.isNull())
            {
                const auto& Antenna_position = resultFileInfo.toStrongRef()->Antenna_position;
                poseSettingData->setTranslationX(Antenna_position.position_X);
                poseSettingData->setTranslationY(Antenna_position.position_Y);
                poseSettingData->setTranslationX(Antenna_position.position_Z);
                poseSettingData->setRotationTheta(Antenna_position.rotate_Theta);
                poseSettingData->setRotationPhi(Antenna_position.rotate_Phi);
                info->m_resultType = resultFileInfo.toStrongRef()->result_type;
            }
            info->m_poseSettingData = poseSettingData;
            if (m_vtuReader.contains(item)) // 判断是否是vtu格式
            {
                info->m_reader = m_vtuReader[item];
                info->readerIndex = m_pyVtuReaderList.indexOf(m_vtuReader[item]);
                info->readerType = "vtu";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtuReader[item]->GetFileName();
                info->m_data = m_vtuReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtuReader[item]->GetGeometryFileName();
            }
            else if (m_vtkReader.contains(item))
            {
                info->m_reader = m_vtkReader[item];
                info->readerIndex = m_pyVtkReaderList.indexOf(m_vtkReader[item]);
                info->readerType = "vtk";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtkReader[item]->GetFileName();
                info->m_data = m_vtkReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtkReader[item]->GetGeometryFileName();
            }
            else if (m_vtpReader.contains(item))
            {
                info->m_reader = m_vtpReader[item];
                info->readerIndex = m_pyVtpReaderList.indexOf(m_vtpReader[item]);
                info->readerType = "vtp";
                info->m_graphType = GraphType::SurfaceElectricFieldMap;
                info->m_filePath = m_vtpReader[item]->GetFileName();
                info->m_data = m_vtpReader[item]->GetOutput();
                info->m_name = item->text();
                info->m_geometryFileName = m_vtpReader[item]->GetGeometryFileName();
            }
            else
            {
                return;
            }

            auto fieldGraphGenerator = new FieldGraphGenerator(this);
            fieldGraphGenerator->SetInputDataSet(info->m_data);
            auto pointArray = fieldGraphGenerator->GetPointsArrayIndexAndNames();
            auto cellArray = fieldGraphGenerator->GetCellsArrayIndexAndNames();
            info->m_allPointArray = pointArray;
            info->m_allCellArray = cellArray;
            info->m_fieldGraphGenerator = fieldGraphGenerator;
            QString sourceStr;
            slot_getThreeDDataSources(info->m_reader, sourceStr);
            info->m_dataSources = sourceStr;
            // 设置item
            info->m_projectTreeSourceItem = item;
            const auto& resultData = m_fileType.value(item);
            if (!resultData->mulitFileInfo.second.isEmpty())
            {
                const auto& pair = resultData->mulitFileInfo.first;
                info->m_fieldType = pair.first;
                info->m_unit = pair.second;
                for (const auto& tmpPair : resultData->mulitFileInfo.second)
                {
                    info->m_VarValueList.append(tmpPair.first);
                }
            }
            if (!info->m_allCellArray.isEmpty() || !info->m_allPointArray.isEmpty())
            {
                auto dialog = new SurfaceElectricFieldMapSelectDataDialog(this);
                dialog->setInfomationGraph3DBasical(info);
                dialog->setIsOpenNewWindow(false);
                dialog->showWindow();
                connect(dialog, &SurfaceElectricFieldMapSelectDataDialog::signal_sentChosenArrayInfo, this, &MainWindow::slot_sentChosenArrayInfo);
            }
            else
            {
                slot_sentChosenArrayInfo(info,false);
            }
        }
    }

    void MainWindow::slot_saveGifSuccess(bool isSuccess)
    {
        if (isSuccess)
        {
            emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("导出动图完成！"), false);
            auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导出动图成功！"), EDialogMsg::Normal, QStringLiteral("成功"), { QStringLiteral("确定") });
            MainWindowSignalHandler::getInstance()->setToolButtonExportMotionGraphState(true);
        }
        else
        {
            emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("导出动图失败！"), false);
            auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导出动图失败！"), EDialogMsg::Error, QStringLiteral("失败"), { QStringLiteral("确定") });
            MainWindowSignalHandler::getInstance()->setToolButtonExportMotionGraphState(true);
        }
        //slot_setToolButtonExportMotionGraph2InterfaceState(true);
    }

    void MainWindow::slot_setDisplayModelButtonCheckState(bool checked)
    {
        QSignalBlocker blocker(m_toolButtonModelDisplay);
        m_toolButtonModelDisplay->setChecked(checked);
    }

    void MainWindow::slot_setClipperButtonCheckState(bool checked)
    {
        QSignalBlocker blocker(m_toolButtonActiveClipper);
        m_toolButtonActiveClipper->setChecked(checked);
    }

    void MainWindow::updateCipperUI()
    {
        auto currentWindow = qobject_cast<Graph3DWindowBase*>(m_centerWidget->getCurrentGraphWindow());
        if (currentWindow == nullptr)
        {
            return;
        }
        auto isClipperActive = currentWindow->getActiveClipper();
        auto getClipNormal = currentWindow->getClipNormalDirection();
        auto getClipOrigin = currentWindow->getClipOrigin();

        QSignalBlocker blocker(m_toolButtonActiveClipper);
        QSignalBlocker blocker2(m_comboBoxClipperNormal);
        QSignalBlocker blocker3(m_lineEditClipperOrigin);
        isClipperActive ? m_toolButtonActiveClipper->setChecked(true) : m_toolButtonActiveClipper->setChecked(false);
        if (qFuzzyCompare(getClipNormal[0], 1) && qFuzzyCompare(getClipNormal[1], 0) && qFuzzyCompare(getClipNormal[2], 0)) // x轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("X");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[0]));
        }
        else if (qFuzzyCompare(getClipNormal[0], 0) && qFuzzyCompare(getClipNormal[1], 1) && qFuzzyCompare(getClipNormal[2], 0)) // y轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("Y");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[1]));
        }
        else if (qFuzzyCompare(getClipNormal[0], 0) && qFuzzyCompare(getClipNormal[1], 0) && qFuzzyCompare(getClipNormal[2], 1)) // z轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("Z");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[2]));
        }
        else if (qFuzzyCompare(getClipNormal[0], -1) && qFuzzyCompare(getClipNormal[1], 0) && qFuzzyCompare(getClipNormal[2], 0)) // x轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("-X");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[0]));
        }
        else if (qFuzzyCompare(getClipNormal[0], 0) && qFuzzyCompare(getClipNormal[1], -1) && qFuzzyCompare(getClipNormal[2], 0)) // y轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("-Y");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[1]));
        }
        else if (qFuzzyCompare(getClipNormal[0], 0) && qFuzzyCompare(getClipNormal[1], 0) && qFuzzyCompare(getClipNormal[2], -1)) // z轴法向
        {
            m_comboBoxClipperNormal->setCurrentText("-Z");
            m_lineEditClipperOrigin->setText(QString::number(getClipOrigin[2]));
        }
    }

    void MainWindow::slot_sendChosen3DSurfaceData(InfomationGraph3DBasical* info, int freIndex, int valueGroupIndex, bool isOpenNewWindow)
    {
        // vtkNew<vtkStructuredGrid> resultData;
        // QString errorMsg;
        // auto isOk = info->m_farFieldDataGenerator->getDataSetByFreqency(fre, false, false, resultData, valueIndex, errorMsg);
        // if (!isOk)
        //{
        //     emit IBaseSignalInstance->signal_sendErrorMessageToUI(errorMsg);
        //     return;
        // }
        ////m_addedFarFieldData.append(resultData);

        ////qDebug() << "resultData = ";
        ////resultData->Print(std::cout);

        ////vtkNew<vtkStructuredGridWriter> writer;
        ////writer->SetInputData(resultData);
        ////QString s = "D:/resultData" + QString::number(fre) + ".vtk";
        ////writer->SetFileName(s.toStdString().c_str());
        ////writer->Write();
        ////info.m_reader = textFileParser;
        ////info.m_graphType = GraphType::ThreeDSurfacePlot;
        ////info.m_filePath = textFileParser->GetFileName();
        // info->m_data = resultData;
        info->m_currentFrequencyIndex = freIndex;
        info->m_valueGroupNameIndex = valueGroupIndex;
        info->m_valueComponentIndex = 0; // 默认第0分量

        QList<InfomationGraph3DBasical*> infoList;
        infoList.append(info);
        m_centerWidget->addImageToGraph3DWindow(infoList, isOpenNewWindow);
    }

    void MainWindow::slot_sendChosen3DCloudData(InfomationGraph3DBasical* info, bool isOpenNewWindow)
    {
        QStringList geometryFileName = info->m_geometryFileName;
        QString geometryFileNameStr = geometryFileName.join(",");

        QStringList _pyCodes{};
        _pyCodes += QString("threedcloudmap = PostProcessing.ThreeDCloudMap()");
        _pyCodes += QString("threedcloudmap.setUseNewWindow(%1)").arg(isOpenNewWindow);
        _pyCodes += QString("threedcloudmap.setVariableIndex(%1)").arg(info->m_valueGroupNameIndex);
        _pyCodes += QString("threedcloudmap.setReaderIndex(%1)").arg(info->readerIndex);
        _pyCodes += QString("threedcloudmap.setGraphType(%1)").arg((int)(info->m_graphType));
        _pyCodes += QString("threedcloudmap.setFilePath('%1')").arg(info->m_filePath);
        _pyCodes += QString("threedcloudmap.setName('%1')").arg(info->m_name.toUtf8().data());
        _pyCodes += QString("threedcloudmap.setGeometryFileName('%1')").arg(geometryFileNameStr.toUtf8().data());
        _pyCodes += QString("threedcloudmap.setResultDataIndex(%1)").arg(info->resultDataIndex);
        _pyCodes += QString("threedcloudmap.create()");
        emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);

        QList<InfomationGraph3DBasical*> infoList = {info};
        m_centerWidget->addImageToGraph3DWindow(infoList, isOpenNewWindow);
    }

    void MainWindow::initWindow()
    {
        // setIsNavigationBarEnable(false);
        // setWindowButtonFlags((ElaAppBarType::ButtonFlags)ElaAppBarType::StayTopButtonHint | ElaAppBarType::MinimizeButtonHint | ElaAppBarType::MaximizeButtonHint | ElaAppBarType::CloseButtonHint);
        // setAppBarHeight(32);
        // setWindowIcon(QIcon(":/QUI/image/logo32.png"));
        setIcon(QIcon(":/QUI/image/logo.ico"));
        resize(1536, 864); // 1920*1080 * 0.8
        setWindowTitle("统一后处理平台");
        setIsMainWindow(true);
        // this->setWindowButtonFlag(ElaAppBarType::StayTopButtonHint, false);
        // this->setStyleSheet("QWidget{background-color: #FFFFFF}");
    }

    void MainWindow::initStatusBar()
    {
        // 状态栏
        m_statusBar = new QStatusBar(this);
        m_statusBar->setFixedHeight(24);
        // QLabel* statusText = new QLabel("初始化成功！", this);
        //  statusText->setTextPixelSize(14);
        // m_statusBar->addWidget(statusText);
        m_statusBar->showMessage(QStringLiteral("初始化成功！"));

        this->setStatusBar(m_statusBar);
    }

    void MainWindow::UpdateStatusBarInformation(QString text, bool isbegin)
    {
        if (isbegin)
            emit IBaseSignalInstance->signal_updateWidgetCursor(Qt::BusyCursor);
        m_statusBar->clearMessage();
        m_statusBar->showMessage(text);
        m_statusBar->update();
        if (!isbegin)
            emit IBaseSignalInstance->signal_updateWidgetCursor(Qt::ArrowCursor);
    }

    void MainWindow::RecycleAllReader()
    {
        QList<TextFileParser*> txtTmp;
        for (auto i : m_txtReader)
        {
            if (!txtTmp.contains(i))
            {
                txtTmp.append(i);
            }
        }
        for (auto i : txtTmp)
        {
            if (i != nullptr)
                i->deleteLater();
        }
        m_txtReader.clear();

        QList<MutiVTUFilesReader*> vtuTmp;
        for (auto i : m_vtuReader)
        {
            if (!vtuTmp.contains(i))
            {
                vtuTmp.append(i);
            }
        }
        for (auto i : vtuTmp)
        {
            if (i != nullptr)
                i->Delete();
        }
        m_vtuReader.clear();

        QList<MutiVTKFilesReader*> vtkTmp;
        for (auto i : m_vtkReader)
        {
            if (!vtkTmp.contains(i))
            {
                vtkTmp.append(i);
            }
        }
        for (auto i : vtkTmp)
        {
            if (i != nullptr)
                delete i;
        }
        m_vtkReader.clear();

        m_vtpReader.clear();
    }

    void MainWindow::RecycleReaderByItems(const QList<QStandardItem*>& itemList)
    {
        for (auto item : itemList)
        {
            if (m_txtReader.contains(item))
            {
                auto reader = m_txtReader.value(item);
                m_txtReader.remove(item);
                bool isExit = false;
                for (auto i : m_txtReader)
                {
                    if (i == reader)
                    {
                        isExit = true;
                        break;
                    }
                }
                if (!isExit)
                {
                    reader->deleteLater();
                }
            }
            if (m_vtuReader.contains(item))
            {
                auto reader = m_vtuReader.value(item);
                m_vtuReader.remove(item);
                bool isExit = false;
                for (auto i : m_vtuReader)
                {
                    if (i == reader)
                    {
                        isExit = true;
                        break;
                    }
                }
                if (!isExit)
                {
                    reader->Delete();
                }
            }
            if (m_vtkReader.contains(item))
            {
                auto reader = m_vtkReader.value(item);
                m_vtkReader.remove(item);
                bool isExit = false;
                for (auto i : m_vtkReader)
                {
                    if (i == reader)
                    {
                        isExit = true;
                        break;
                    }
                }
                if (!isExit)
                {
                    delete reader;
                }
            }
            m_vtpReader.remove(item);

            //关闭项目树时，删除对应子节点数据
            auto _key = m_EvaluationSubmissionNodeCorrespondence.keys(item);
            if (!_key.isEmpty())
                m_EvaluationSubmissionNodeCorrespondence.remove(_key.at(0));
            if (m_pointElectricFieldData.contains(item))
                m_pointElectricFieldData.remove(item);
        }
    }

    bool MainWindow::TextImportDataProcessing(int itemID, QString filePath, const QVector<std::tuple<QString, DialogDataImportConfiguration::DataProperty, QVector<double>>>& datas, const JsonParser::ProjectDataPointer& projectData)
    {
        QFileInfo fileInfo;
        fileInfo.setFile(filePath);
        if (!fileInfo.exists())
            return false;
        if (projectData->projectResultData.isEmpty())
        {
            m_errorMessageList.append(fileInfo.absoluteFilePath());
            return false;
        }
        vtkSmartPointer<vtkTable> table = vtkSmartPointer<vtkTable>::New();
        for (size_t colIndex = 0; colIndex < datas.size(); ++colIndex)
        {
            vtkSmartPointer<vtkDoubleArray> column = vtkSmartPointer<vtkDoubleArray>::New();
            column->SetName(std::get<0>(datas.at(colIndex)).toUtf8()); // 设置列名

            // 将 vector<double> 数据插入到 vtkDoubleArray 中
            for (double value : std::get<2>(datas.at(colIndex)))
            {
                column->InsertNextValue(value);
            }

            // 给生成的每一列添加meta信息
            TextArrayMetaStruct meta;

            const auto& dataProperty = std::get<1>(datas.at(colIndex));
            if (dataProperty.type == DialogDataImportConfiguration::Key)
            {
                meta.keyValueType = 0;
                meta.resultDataType = 4;
                meta.relatedScalarIndex = colIndex;
                meta.dataGroupName = dataProperty.name;
                meta.unit = dataProperty.unit;
            }
            else if (dataProperty.type == DialogDataImportConfiguration::Value)
            {
                meta.keyValueType = 1;
                if (dataProperty.dependentVariable.contains("标量"))
                {
                    meta.resultDataType = 4;
                    meta.relatedScalarIndex = colIndex;
                    meta.dataGroupName = dataProperty.name;
                }
                else
                {
                    if (dataProperty.dependentVariableType == "幅度")
                    {
                        meta.resultDataType = 2;
                        meta.relatedMagPartIndex = colIndex;
                    }
                    else if (dataProperty.dependentVariableType == "相位")
                    {
                        meta.resultDataType = 3;
                        meta.relatedPhasePartIndex = colIndex;
                    }
                    else if (dataProperty.dependentVariableType == "实部")
                    {
                        meta.resultDataType = 0;
                        meta.relatedRealPartIndex = colIndex;
                    }
                    else if (dataProperty.dependentVariableType == "虚部")
                    {
                        meta.resultDataType = 1;
                        meta.relatedImagPartIndex = colIndex;
                    }
                    QString name = dataProperty.name;
                    QRegularExpression reg("^.+\\((.*))$");
                    auto match = reg.match(name);
                    if (match.hasMatch())
                    {
                        name = match.captured(1);
                    }
                    meta.dataGroupName = name;
                }
                meta.resultParaType = GetResultParaType(dataProperty.category);
                meta.unit = dataProperty.unit;
            }

            // TODO 给meta赋值
            TextArrayMetaHander::setArrayMeta(column, meta);

            // 添加列到表中
            table->AddColumn(column);
        }
        QHash<QString, TextArrayMetaStruct> hashTmp;
        for (int i = 0; i < table->GetNumberOfColumns(); ++i)
        {
            auto array = table->GetColumn(i);
            TextArrayMetaStruct metaStruct;
            TextArrayMetaHander::getArrayMeta(array, metaStruct);
            if (metaStruct.resultDataType != 4)
            {
                const QString dataGroupName = metaStruct.dataGroupName;
                if (!hashTmp.contains(dataGroupName))
                {
                    hashTmp.insert(dataGroupName, metaStruct);
                }
                else
                {
                    auto& meta = hashTmp[dataGroupName];
                    if (metaStruct.relatedRealPartIndex != -1)
                    {
                        meta.relatedRealPartIndex = metaStruct.relatedRealPartIndex;
                    }
                    if (metaStruct.relatedImagPartIndex != -1)
                    {
                        meta.relatedImagPartIndex = metaStruct.relatedImagPartIndex;
                    }
                    if (metaStruct.relatedMagPartIndex != -1)
                    {
                        meta.relatedMagPartIndex = metaStruct.relatedMagPartIndex;
                    }
                    if (metaStruct.relatedPhasePartIndex != -1)
                    {
                        meta.relatedPhasePartIndex = metaStruct.relatedPhasePartIndex;
                    }
                }
            }
        }
        for (const auto& meta : hashTmp)
        {
            auto metaSruct = meta;
            if (meta.relatedRealPartIndex != -1)
            {
                metaSruct.resultDataType = 0;
                TextArrayMetaHander::setArrayMeta(table->GetColumn(meta.relatedRealPartIndex), metaSruct);
            }
            if (meta.relatedImagPartIndex != -1)
            {
                metaSruct.resultDataType = 1;
                TextArrayMetaHander::setArrayMeta(table->GetColumn(meta.relatedImagPartIndex), metaSruct);
            }
            if (meta.relatedMagPartIndex != -1)
            {
                metaSruct.resultDataType = 2;
                TextArrayMetaHander::setArrayMeta(table->GetColumn(meta.relatedMagPartIndex), metaSruct);
            }
            if (meta.relatedPhasePartIndex != -1)
            {
                metaSruct.resultDataType = 3;
                TextArrayMetaHander::setArrayMeta(table->GetColumn(meta.relatedPhasePartIndex), meta);
            }
        }
        vtkNew<vtkStringArray> annotations;
        annotations->SetName("HeadComment");
        annotations->SetNumberOfValues(1);
        annotations->SetValue(0, "# comac datafile version 1.0");
        table->GetFieldData()->AddArray(annotations);
        vtkNew<vtkStringArray> headerText;
        headerText->SetName("Header");
        headerText->SetNumberOfValues(1);
        headerText->SetValue(0, "# comac datafile version 1.0");
        table->GetFieldData()->AddArray(headerText);

        TextExpander* textExpander = new TextExpander(this);
        textExpander->setInputTable(table);
        bool isOk1 = textExpander->update();
        if (!isOk1)
        {
            delete textExpander;
            m_errorMessageList.append(fileInfo.absoluteFilePath());
            return false;
        }
        else
        {

            QStandardItem* item = new QStandardItem(fileInfo.completeBaseName());
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);

            TextFileParser* parser = new TextFileParser(this);
            parser->SetInputTable(textExpander->getExpandedTable());

            auto fileName = fileInfo.fileName();
            //writeImportedTextToProjectTempIO(textExpander->getExpandedTable(), fileName);

            // TODO 设置文件类型
            // parser->setFileDealType();
            // parser->setFileComponentType();
            bool isSuccess = parser->Update();
            if (isSuccess)
            {
                parser->SetOtherList({parser});
                parser->SetGeometryFileName({});
                m_txtReader[item] = parser;
                m_pyTextParserList.append(parser);

                m_fileType[item] = projectData->projectResultData.first();
                m_centerWidget->addFileNode(item, true);
                // txt文件有对话框处理过程，需单独处理
                if (!GlobalHelperInstance->getIsOpenProject())
                {
                    item->setData(ProjectTreeDataInstance->generateProjectTreeItemID(), Qt::UserRole + 10);
                }
                else
                {
                    item->setData(itemID, Qt::UserRole + 10);
                }               
                ProjectTreeDataInstance->appendPasteAndImportItemData(-1, item->data(Qt::UserRole + 10).toInt(), filePath);
                if (!GlobalHelperInstance->getIsOpenProject())
                    DataImportConfigurationDataInstance->addImportItemID(item->data(Qt::UserRole + 10).toInt());
                m_pyFileTypeList.append(projectData->projectResultData.first());

                auto jsonParser = JsonParser::GetInstance();
                jsonParser->AddResultData(projectData);
            }
            else
            {
                delete parser;
                delete item;
                m_errorMessageList.append(fileInfo.absoluteFilePath());
                return false;
            }
        }
        return true;
    }

    bool MainWindow::slot_toolBtnImportDataClick(QString filepath)
    {
        // QWidget* widget = new QWidget();
        // widget->setWindowTitle(tr("数据导入"));
        //  widget->setWindowButtonFlag(ElaAppBarType::StayTopButtonHint, false);
        // widget->setWindowModality(Qt::ApplicationModal);
        // QHBoxLayout* hBoxLayout = new QHBoxLayout(this);
        // QPushButton* localImport = new QPushButton(tr("本地导入"), widget);
        // hBoxLayout->addWidget(localImport);
        // QPushButton* databaseImport = new QPushButton(tr("数据库导入"), widget);
        // databaseImport->setEnabled(false);
        // hBoxLayout->addWidget(databaseImport);
        // hBoxLayout->setSpacing(20);
        // hBoxLayout->setMargin(50);
        // hBoxLayout->setSizeConstraint(QLayout::SetFixedSize);
        // widget->setLayout(hBoxLayout);
        // widget->show();
        //  本地导入响应
        // connect(localImport, &QPushButton::clicked, [this, widget]()
        //{
        // widget->close();
        

        QFileInfo fileInfo;
        QStringList textList;
        m_errorMessageList.clear();
        // for (const auto& filepath : filepathList)
        {
            fileInfo.setFile(filepath);
            if (!fileInfo.exists())
            {
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("数据导入路径不存在！"), EDialogMsg::Error, QStringLiteral("失败"), {QStringLiteral("确定")});
                return false;
            }
            if (fileInfo.suffix() == "txt" || fileInfo.suffix() == "csv")
            {
                // 选择文档单击打开，显示对话框，用于调试
                if(!GlobalHelperInstance->getIsOpenProject())
                {
                    auto _dialog = new DialogDataImportConfiguration(filepath, this);
                    _dialog->showWindow();
                }
                else
                {
                    DataImportConfigurationDataInstance->executeTextReadAndImport(filepath);
                }
                // QStandardItem* item = new QStandardItem(fileInfo.completeBaseName());
                // item->setFlags(item->flags() & ~Qt::ItemIsEditable);
                // if (slot_readTxtData(fileInfo.absoluteFilePath(), item)) {
                //     QSharedPointer<ResultDataInfo> resultInfo = QSharedPointer<ResultDataInfo>::create();
                //     resultInfo->path = fileInfo.absoluteFilePath();
                //     resultInfo->fileType = FileDataType::File2DCurve | FileDataType::FileTwoDHeatMap;
                //     m_fileType[item] = resultInfo;
                //     m_centerWidget->addFileNode(item);
                // }
                // else {
                //     delete item;
                //     m_errorMessageList.append(fileInfo.absoluteFilePath());
                // }
            }
            else if (fileInfo.suffix() == "vtu")
            {
                UpdateStatusBarInformation(QStringLiteral("导入数据正在进行中..."), true);
                QCoreApplication::processEvents();
                QStandardItem* item = new QStandardItem(fileInfo.completeBaseName());
                item->setFlags(item->flags() & ~Qt::ItemIsEditable);
                if (slot_readVTUData(fileInfo.absoluteFilePath(), item))
                {
                    QSharedPointer<ResultDataInfo> resultInfo = QSharedPointer<ResultDataInfo>::create();
                    resultInfo->path = fileInfo.absoluteFilePath();
                    resultInfo->fileType = FileDataType::FileSurfaceElectricFieldGraph;
                    m_fileType[item] = resultInfo;
                    m_centerWidget->addFileNode(item, true);
                    item->setData(ProjectTreeDataInstance->generateProjectTreeItemID(), Qt::UserRole + 10);
                    ProjectTreeDataInstance->appendPasteAndImportItemData(-1, item->data(Qt::UserRole + 10).toInt(), resultInfo->path);
                    m_pyFileTypeList.append(resultInfo);
                    UpdateStatusBarInformation(QStringLiteral("导入数据成功！"), false);
                    if (GlobalHelperInstance->getIsNeedPopupWindow() && !GlobalHelperInstance->getIsPythonRunning())
                        auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导入数据成功！"), EDialogMsg::Normal, QStringLiteral("成功"), {QStringLiteral("确定")});
                }
                else
                {
                    delete item;
                    m_errorMessageList.append(fileInfo.absoluteFilePath());
                }
            }
            else if (fileInfo.suffix() == "vtk")
            {
                UpdateStatusBarInformation(QStringLiteral("导入数据正在进行中..."), true);
                QCoreApplication::processEvents();
                QStandardItem* item = new QStandardItem(fileInfo.completeBaseName());
                item->setFlags(item->flags() & ~Qt::ItemIsEditable);
                if (slot_readVTKData(fileInfo.absoluteFilePath(), item))
                {
                    QSharedPointer<ResultDataInfo> resultInfo = QSharedPointer<ResultDataInfo>::create();
                    resultInfo->path = fileInfo.absoluteFilePath();
                    resultInfo->fileType = FileDataType::FileSurfaceElectricFieldGraph;
                    m_fileType[item] = resultInfo;
                    m_centerWidget->addFileNode(item, true);
                    item->setData(ProjectTreeDataInstance->generateProjectTreeItemID(), Qt::UserRole + 10);
                    ProjectTreeDataInstance->appendPasteAndImportItemData(-1, item->data(Qt::UserRole + 10).toInt(), resultInfo->path);
                    m_pyFileTypeList.append(resultInfo);
                    UpdateStatusBarInformation(QStringLiteral("导入数据成功！"), false);
                    if (GlobalHelperInstance->getIsNeedPopupWindow() && !GlobalHelperInstance->getIsPythonRunning())
                        auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导入数据成功！"), EDialogMsg::Normal, QStringLiteral("成功"), {QStringLiteral("确定")});
                }
                else
                {
                    delete item;
                    m_errorMessageList.append(fileInfo.absoluteFilePath());
                }
            }
            else if (fileInfo.suffix() == "vtp")
            {
                UpdateStatusBarInformation(QStringLiteral("导入数据正在进行中..."), true);
                QCoreApplication::processEvents();
                QStandardItem* item = new QStandardItem(fileInfo.completeBaseName());
                item->setFlags(item->flags() & ~Qt::ItemIsEditable);
                if (slot_readVTPData(fileInfo.absoluteFilePath(), item))
                {
                    QSharedPointer<ResultDataInfo> resultInfo = QSharedPointer<ResultDataInfo>::create();
                    resultInfo->path = fileInfo.absoluteFilePath();
                    resultInfo->fileType = FileDataType::FileSurfaceElectricFieldGraph;
                    m_fileType[item] = resultInfo;
                    m_centerWidget->addFileNode(item, true);
                    item->setData(ProjectTreeDataInstance->generateProjectTreeItemID(), Qt::UserRole + 10);
                    ProjectTreeDataInstance->appendPasteAndImportItemData(-1, item->data(Qt::UserRole + 10).toInt(), resultInfo->path);
                    m_pyFileTypeList.append(resultInfo);
                    UpdateStatusBarInformation(QStringLiteral("导入数据成功！"), false);
                    if (GlobalHelperInstance->getIsNeedPopupWindow() && !GlobalHelperInstance->getIsPythonRunning())
                        auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导入数据成功！"), EDialogMsg::Normal, QStringLiteral("成功"), {QStringLiteral("确定")});
                }
                else
                {
                    delete item;
                    m_errorMessageList.append(fileInfo.absoluteFilePath());
                }
            }
        }
        if (!m_errorMessageList.isEmpty())
        {
            UpdateStatusBarInformation(QStringLiteral("导入数据失败！"), false);
            if (GlobalHelperInstance->getIsNeedPopupWindow())
                EDialogMsgResult _result = IdaDialogMsg::showDialog(this, m_errorMessageList.join("\n"), EDialogMsg::Error, tr("导入失败列表"));
            return false;
        }
        m_errorMessageList.clear();
        return true;
        // widget->deleteLater(); // 导入后自动回收导入窗口
        //});
    }

    void MainWindow::slot_exportBtnClick()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        exportPstData("");
    }

    static void DuplicateNameHandling(QStandardItem* parentItem)
    {
        QHash<QString, QVector<QStandardItem*>> nameItems;
        for (int i = 0; i < parentItem->rowCount(); ++i)
        {
            auto child = parentItem->child(i);
            if (child->hasChildren())
            {
                DuplicateNameHandling(child);
            }
            auto name = child->text();
            if (nameItems.contains(name))
            {
                nameItems[name].append(child);
            }
            else
            {
                nameItems.insert(name, {child});
            }
        }
        for (const auto& items : nameItems)
        {
            if (items.size() < 2)
            {
                continue;
            }
            for (int i = 0; i < items.size(); ++i)
            {
                auto item = items.at(i);
                item->setText(item->text() + "_" + QString::number(i + 1));
            }
        }
    };

    // 解决新的传入参数问题
    void MainWindow::slot_importProjectData()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        slot_importProjectDataInternal(false); // 默认旧行为
    }

    bool MainWindow::slot_importProjectDataInternal(bool fromTheCommand)
    {
        // 读取数据函数
        auto readDataFunc = [this](const QString& path, QStandardItem* item, const QStringList& geometryFileName = QStringList(), const ResultDataPointer& resultDataPointer = ResultDataPointer())
        {
            bool isReadSuccessfully = false;
            QFileInfo info(path);
            if (info.suffix() == "txt" || info.suffix() == "csv")
            {
                isReadSuccessfully = slot_readTxtData(path, item, geometryFileName, resultDataPointer);
            }
            else if (info.suffix() == "vtu")
            {
                isReadSuccessfully = slot_readVTUData(path, item, geometryFileName);
            }
            else if (info.suffix() == "vtk")
            {
                isReadSuccessfully = slot_readVTKData(path, item, geometryFileName);
            }
            else if (info.suffix() == "vtp")
            {
                isReadSuccessfully = slot_readVTPData(path, item, geometryFileName);
            }
            else if (info.suffix() == "png" || info.suffix() == "jpg")
            {
                isReadSuccessfully = true;
            }
            return isReadSuccessfully;
        };
        auto findRootItemFunc = [](CenterWidget* centerWidget, const QString& name)
        {
            QStandardItem* pre_design_name = nullptr;
            auto model = qobject_cast<QStandardItemModel*>(centerWidget->getTreeView()->model());
            for (int i = 0; i < model->rowCount(); ++i)
            {
                auto item = model->item(i);
                if (item->text() == name)
                {
                    pre_design_name = item;
                    break;
                }
            }
            return pre_design_name;
        };
        auto findChildItemFunc = [](QStandardItem* parentItem, const QString& name)
        {
            QStandardItem* item = nullptr;
            for (int i = 0; i < parentItem->rowCount(); ++i)
            {
                auto childItem = parentItem->child(i);
                if (childItem->text() == name)
                {
                    item = childItem;
                    break;
                }
            }
            return item;
        };

        if (!m_fileType.isEmpty())
        {
            if(!GlobalHelperInstance->getIsPythonRunning())
            {
                int isConfirm = 2;
                IBaseSignalInstance->signal_sendQuestionMessageToUI(isConfirm, "打开工程结果", "重复打开工程结果将清空数据展示栏已有数据及结果窗口并展示最新的工程结果，请确认是否执行该操作");
                if (isConfirm != 2)
                {
                    return false;
                }
            }
            slot_clearCurrentProjectAllData();
        }

        QList<QFileInfo> fileInfoList; // 解析找到的所有json文件信息列表

        if (m_isNotInput && !fromTheCommand)
        {
            m_inputDirList.clear();
            auto targetDir = QDir::home();
            if (targetDir.cd("PostProcessingJson"))
            {
                IdaDialogFrame* dialog = new IdaDialogFrame(this);
                auto uiFirst = new Ui::DialogImportProjectFirst();
                uiFirst->setupUi(dialog);
                uiFirst->label_thunderbolt->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                uiFirst->label_antenna->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                uiFirst->label_HIRF->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                uiFirst->label_microwave->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                uiFirst->label_electrostatic->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                uiFirst->label_NEMP->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
                IdaWidgetHelperInstance->setMainButtonStyle(uiFirst->pushButton_next); // 将确定设置为主按钮
                dialog->setWindowTitle(tr("打开工程结果"));
                const auto& objectList = dialog->children();
                for (auto object : objectList)
                {
                    if (QString(object->metaObject()->className()) == QStringLiteral("QCheckBox") && object->objectName() != "checkBox_selectAll")
                    {
                        connect(qobject_cast<QCheckBox*>(object), &QCheckBox::clicked, [objectList, uiFirst]()
                                {
                                int number = 0;
                                for (auto object : objectList)
                                {
                                    if (QString(object->metaObject()->className()) == QStringLiteral("QCheckBox") && object->objectName() != "checkBox_selectAll")
                                    {
                                        number += qobject_cast<QCheckBox*>(object)->isChecked() ? 1 : 0;
                                    }
                                }
                                if (number == 0)
                                {
                                    uiFirst->pushButton_next->setEnabled(false);
                                }
                                else
                                {
                                    uiFirst->pushButton_next->setEnabled(true);
                                }
                                if (number == 6)
                                {
                                    uiFirst->checkBox_selectAll->setChecked(true);
                                }
                                else
                                {
                                    uiFirst->checkBox_selectAll->setChecked(false);
                                } });
                    }
                }
                connect(uiFirst->checkBox_selectAll, &QCheckBox::clicked, [this, uiFirst]()
                        {
                        uiFirst->checkBox_thunderbolt->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->checkBox_antenna->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->checkBox_HIRF->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->checkBox_microwave->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->checkBox_electrostatic->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->checkBox_NEMP->setChecked(uiFirst->checkBox_selectAll->isChecked());
                        uiFirst->pushButton_next->setEnabled(uiFirst->checkBox_selectAll->isChecked()); });
                connect(uiFirst->pushButton_next, &QPushButton::clicked, [this, uiFirst, dialog, targetDir]()
                        { slot_showImportProjectFirst(uiFirst, dialog, targetDir); });
                connect(uiFirst->pushButton_cancel, &QPushButton::clicked, [this, dialog]()
                        { dialog->closeWindow(); });
                uiFirst->pushButton_next->setEnabled(false);
                dialog->execWindow();
            }
            else
            {
                m_errorMessageList.append("PostProcessingJson 文件夹不存在");
            }
        }

        // m_inputDirList.append(QApplication::applicationDirPath() + "/../examples");
        //UpdateStatusBarInformation(QString("打开工程结果正在进行中..."), true);
        //QCoreApplication::processEvents();

        QString filepaths = m_inputDirList.join(",");
        filepaths.replace("\\", "/");
        GlobalHelperInstance->setSimulationDataFilePath(filepaths);
        if (!GlobalHelperInstance->getIsOpenProject())
        {
            QString pycode = QString("%1%2'%3'%4").arg("PostProcessing.importProjectData").arg("(").arg(filepaths).arg(")");
            emit IBaseSignalInstance->signal_execPYCode(QStringList{pycode}, true, false);
        }

        auto _inputDirListSize = m_inputDirList.size();
        QStringList _errorDirStringList{};
        QStringList _errorDataStringList{};
        for (const auto& dir1 : m_inputDirList)
        {
            QList<QFileInfo> _tempfileInfoList{}; // 用于判断报错
            QDir currentDir(dir1);
            qDebug() << "Input working path is " << currentDir.absolutePath();
            if (currentDir.exists())
            {
                fileInfoList.append(currentDir.entryInfoList(QStringList("*.json"), QDir::Files));
                _tempfileInfoList.append(currentDir.entryInfoList(QStringList("*.json"), QDir::Files));
                const auto& infoList = currentDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
                for (const auto& info : infoList)
                {
                    qDebug() << info;
                    QDir dir(info.absoluteFilePath());
                    fileInfoList.append(dir.entryInfoList(QStringList("*.json"), QDir::Files));
                    _tempfileInfoList.append(dir.entryInfoList(QStringList("*.json"), QDir::Files));
                    const auto& infoListTmp = dir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
                    for (const auto& infoTmp : infoListTmp)
                    {
                        qDebug() << infoTmp;
                        QDir dirTmp(infoTmp.absoluteFilePath());
                        fileInfoList.append(dirTmp.entryInfoList(QStringList("*.json"), QDir::Files));
                        _tempfileInfoList.append(dirTmp.entryInfoList(QStringList("*.json"), QDir::Files));
                    }
                }
                if (_tempfileInfoList.isEmpty())
                {
                    _errorDataStringList.append(currentDir.absolutePath());
                }
            }
            else
            {
                _errorDirStringList.append(currentDir.absolutePath());
            }
        }
        if (!_errorDirStringList.isEmpty())
        {
            qDebug() << "Working path is not exist!";
            auto _errorStr = _errorDirStringList.join("\n");
            QString msg = "以下工作路径不存在:  \n" + _errorStr;
            IBaseSignalInstance->signal_sendErrorMessageToUI(msg);
            if (_inputDirListSize == _errorDirStringList.size())
            {
                return false;
            }
        }
        if (!_errorDataStringList.isEmpty())
        {
            qDebug() << "Working path is not exist!";
            auto _errorStr = _errorDataStringList.join("\n");
            QString msg = "以下工作路径不存在有效数据:  \n" + _errorStr;
            IBaseSignalInstance->signal_sendErrorMessageToUI(msg);
            if (_inputDirListSize == _errorDataStringList.size())
            {
                return false;
            }
        }
        UpdateStatusBarInformation(QStringLiteral("打开工程结果正在进行中..."), true);
        QCoreApplication::processEvents();

        // 读取所有jsom文件解析
        QList<QPair<QString, QStringList>> jsonErrorList;
        JsonParser* jsonParser = JsonParser::GetInstance();
        for (const auto& fileInfo : fileInfoList)
        {
            // 只有带'result'的json文件才是结果文件，才读取解析
            if (!fileInfo.completeBaseName().contains("result", Qt::CaseInsensitive))
            {
                continue;
            }
            QDir::setCurrent(fileInfo.absolutePath());
            const auto& projectInfo = jsonParser->GetProjectInfo(fileInfo.absoluteFilePath());
            if (!projectInfo.errorMessageList.isEmpty())
            {
                jsonErrorList.append(qMakePair(fileInfo.absoluteFilePath(), projectInfo.errorMessageList));
                continue;
            }
            if (!projectInfo.waringMessgaeList.isEmpty())
            {
                jsonErrorList.append(qMakePair(fileInfo.absoluteFilePath(), projectInfo.waringMessgaeList));
            }
            // m_errorMessageList.append(std::move(projectInfo.errorMessageList));
            const auto& projectData = projectInfo.projectData;
            if (projectData.isNull())
            {
                continue;
            }
            // 任意json文件，sim_project_info信息中具有公共父节点的会合并
            for (const auto& data : projectData->projectFileData)
            {
                //可以评估提交的父节点判断
                bool _isCanEvaluationSubmissionParent = false;
                auto _sim_sceneNum = data.sim_project_info.sim_scene;
                if (_sim_sceneNum == 0 || _sim_sceneNum == 1 || _sim_sceneNum == 2 || _sim_sceneNum==3)
                    _isCanEvaluationSubmissionParent = true;

                bool RootItemExist = true;
                QStandardItem* pre_design_name = findRootItemFunc(m_centerWidget, data.sim_project_info.pre_design_name);
                if (pre_design_name == nullptr)
                {
                    RootItemExist = false;
                    pre_design_name = new QStandardItem(data.sim_project_info.pre_design_name); // 仿真工程对应预设计的名称item
                    pre_design_name->setFlags(pre_design_name->flags() & ~Qt::ItemIsEditable);
                }
                QStandardItem* simulationScenario = findChildItemFunc(pre_design_name, GetSimulationScenario(data.sim_project_info.sim_scene));
                if (simulationScenario == nullptr)
                {
                    simulationScenario = new QStandardItem(GetSimulationScenario(data.sim_project_info.sim_scene)); // 对应的仿真场景item
                    simulationScenario->setFlags(simulationScenario->flags() & ~Qt::ItemIsEditable);
                    pre_design_name->appendRow(simulationScenario);
                }
                QStandardItem* name = findChildItemFunc(simulationScenario, data.sim_project_info.name);
                if (name == nullptr)
                {
                    name = new QStandardItem(data.sim_project_info.name); // 仿真工程的名称item
                    name->setFlags(name->flags() & ~Qt::ItemIsEditable);
                    simulationScenario->appendRow(name);
                }
                QStringList geometryFileNnameList;
                const auto& geometry_file_name_list = data.sim_project_info.geometry_file_name;
                for (const auto& fileName : geometry_file_name_list)
                {
                    QFileInfo geometryFile(fileName);
                    // if (geometryFile.exists())
                    //{
                    geometryFileNnameList.append(geometryFile.absoluteFilePath());
                    //}
                }
                // 处理所有json结果文件数据
                for (const auto& info : data.result_info)
                {
                    //可以评估提交的子节点判断
                    bool _isCanEvaluationSubmissionChild = false;
                    auto _result_type = info->result_type;
                    if (_result_type == 2 || _result_type == 10 || _result_type == 11)
                        _isCanEvaluationSubmissionChild = true;
                    // 处理结果文件数据信息
                    for (const auto& result : info->result_data)
                    {
                        // QStandardItem* typeName = new QStandardItem(result->resultDataType); // 结果数据类型名item
                        QStandardItem* typeName = new QStandardItem(QFileInfo(result->path).completeBaseName() + QString("(%1)").arg(result->resultDataType)); // 结果数据类型名item
                        typeName->setFlags(typeName->flags() & ~Qt::ItemIsEditable);
                        // 判断为单个文件
                        if (!result->isDir)
                        {
                            if (readDataFunc(result->path, typeName, geometryFileNnameList, result))
                            {
                                const QString& suffix = QFileInfo(result->path).suffix();
                                if (suffix == "txt" || suffix == "csv")
                                {
                                    result->fileType |= FileDataType::FileDataTable;
                                }
                                name->appendRow(typeName);
                                m_fileType[typeName] = result;
                                m_pyFileTypeList.append(result);
                                if (_isCanEvaluationSubmissionParent && _isCanEvaluationSubmissionChild)
                                {
                                    m_EvaluationSubmissionNodeCorrespondence.insert(_sim_sceneNum, typeName);
                                    if (_result_type == 2)
                                    {
                                        savePointElectricFieldData(typeName);
                                    }
                                }
                            }
                            else
                            {
                                delete typeName;
                                m_errorMessageList.append(result->path);
                            }
                        }
                        // 判断为文件夹
                        else
                        {
                            const auto& mulitFileInfo = result->mulitFileInfo;
                            QList<QStandardItem*> childItemList;
                            for (const auto& file : mulitFileInfo.second)
                            {
                                QString fileNameStr;
                                if (data.sim_project_info.sim_scene == 3 && (info->result_type == 2 || info->result_type == 10 || info->result_type == 11))
                                {
                                    fileNameStr = QFileInfo(file.second).completeBaseName();
                                }
                                else
                                {
                                    fileNameStr = QString::number(file.first) + mulitFileInfo.first.second;
                                }
                                QStandardItem* fileName = new QStandardItem(fileNameStr); // 文件名item
                                fileName->setFlags(fileName->flags() & ~Qt::ItemIsEditable);
                                ResultDataPointer tmp = ResultDataPointer::create();
                                tmp->isDir = false;
                                tmp->path = file.second;
                                tmp->fileType = result->fileType;
                                tmp->resultFileInfo = result->resultFileInfo;
                                tmp->mulitFileInfo = result->mulitFileInfo; // 存放包含自身在内的兄弟信息
                                if (readDataFunc(tmp->path, fileName, geometryFileNnameList, result))
                                {
                                    const QString& suffix = QFileInfo(tmp->path).suffix();
                                    if (suffix == "txt" || suffix == "csv")
                                    {
                                        tmp->fileType |= FileDataType::FileDataTable;
                                    }
                                    typeName->appendRow(fileName);
                                    m_fileType[fileName] = tmp;
                                    m_pyFileTypeList.append(tmp);
                                    childItemList.append(fileName);
                                }
                                else
                                {
                                    delete fileName;
                                    m_errorMessageList.append(file.second);
                                }
                            }
                            if (typeName->hasChildren())
                            {
                                name->appendRow(typeName);
                                QFileInfo info(result->mulitFileInfo.second.first().second);
                                if (info.suffix() == "txt" || info.suffix() == "csv")
                                {
                                    QList<TextFileParser*> rederList;
                                    for (const auto& item : childItemList)
                                    {
                                        rederList.append(m_txtReader[item]);
                                        if (_isCanEvaluationSubmissionParent && _isCanEvaluationSubmissionChild)
                                        {
                                            m_EvaluationSubmissionNodeCorrespondence.insert(_sim_sceneNum, item);
                                            if (_result_type == 2)
                                            {
                                                savePointElectricFieldData(item);
                                            }
                                        }
                                    }
                                    for (auto reader : rederList)
                                    {
                                        reader->SetOtherList(rederList);
                                    }
                                }
                                else if (info.suffix() == "vtu")
                                {
                                    QList<MutiVTUFilesReader*> rederList;
                                    for (const auto& item : childItemList)
                                    {
                                        rederList.append(m_vtuReader[item]);
                                    }
                                    for (auto reader : rederList)
                                    {
                                        reader->SetOtherList(rederList);
                                    }
                                }
                                else if (info.suffix() == "vtk")
                                {
                                    QList<MutiVTKFilesReader*> rederList;
                                    for (const auto& item : childItemList)
                                    {
                                        rederList.append(m_vtkReader[item]);
                                    }
                                    for (auto reader : rederList)
                                    {
                                        reader->SetOtherList(rederList);
                                    }
                                }
                                else if (info.suffix() == "vtp")
                                {
                                    QList<VTPFilesReader*> rederList;
                                    for (const auto& item : childItemList)
                                    {
                                        rederList.append(m_vtpReader[item]);
                                    }
                                    for (auto reader : rederList)
                                    {
                                        reader->SetOtherList(rederList);
                                    }
                                }
                                // m_fileType[typeName] = result;
                            }
                            else
                            {
                                delete typeName;
                                m_errorMessageList.append(result->path);
                            }
                        }
                    }
                }
                // 不存在结果文件数据的情况下会删除相关父节点
                if (name->hasChildren())
                {
                    if (!RootItemExist)
                    {
                        m_centerWidget->addFileNode(pre_design_name);
                    }
                }
                else
                {
                    simulationScenario->removeRow(simulationScenario->rowCount() - 1);
                    if (!simulationScenario->hasChildren())
                    {
                        pre_design_name->removeRow(pre_design_name->rowCount() - 1);
                    }
                    if (!pre_design_name->hasChildren())
                    {
                        delete pre_design_name;
                    }
                }
            }
        }
        // 所有同一层级不能同名
        QHash<QString, QVector<QStandardItem*>> nameItems;
        auto model = qobject_cast<QStandardItemModel*>(m_centerWidget->getTreeView()->model());
        for (int i = 0; i < model->rowCount(); ++i)
        {
            auto item = model->item(i);
            DuplicateNameHandling(item);
            auto name = item->text();
            if (nameItems.contains(name))
            {
                nameItems[name].append(item);
            }
            else
            {
                nameItems.insert(name, {item});
            }
        }
        for (const auto& items : nameItems)
        {
            if (items.size() < 2)
            {
                continue;
            }
            for (int i = 0; i < items.size(); ++i)
            {
                auto item = items.at(i);
                item->setText(item->text() + "_" + QString::number(i + 1)); // 对同名的处理
            }
        }
        ProjectTreeDataInstance->setProjectTreeAllItemID();
        if (jsonErrorList.isEmpty() && m_errorMessageList.isEmpty())
            UpdateStatusBarInformation(QStringLiteral("打开工程结果完成！"), false);
        else
            UpdateStatusBarInformation(QStringLiteral("打开工程结果失败！"), false);
        if (!jsonErrorList.isEmpty())
        {
            QDialog* dialog = new QDialog();
            dialog->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowCloseButtonHint);
            dialog->setWindowTitle("json错误列表");
            QHBoxLayout* hBoxLayout = new QHBoxLayout(dialog);
            QTreeWidget* treeWidget = new QTreeWidget(dialog);
            treeWidget->setHeaderHidden(true);
            hBoxLayout->addWidget(treeWidget);
            dialog->setLayout(hBoxLayout);
            for (const auto& jsonError : jsonErrorList)
            {
                auto topLevelItem = new QTreeWidgetItem(treeWidget, {jsonError.first});
                for (const auto& error : jsonError.second)
                {
                    auto errorItem = new QTreeWidgetItem(topLevelItem, {error});
                }
                treeWidget->addTopLevelItem(topLevelItem);
            }
            dialog->exec();
        }
        if (!m_errorMessageList.isEmpty())
        {
            EDialogMsgResult _result = IdaDialogMsg::showDialog(this, m_errorMessageList.join("\n"), EDialogMsg::Error, tr("导入失败列表"));
        }
        m_errorMessageList.clear();
        return true;
    }

    bool MainWindow::savePointElectricFieldData(QStandardItem* projectTreeChildItem)
    {
        // 写出文件，用一个文件夹存所有生成的文件
        QString dirName = GlobalHelperInstance->getProjectTempIODir() + "/PointElectricFieldData";
        QDir _dir(dirName);
        if (!_dir.exists(dirName))
        {
            auto isOk = _dir.mkpath(dirName);
            if (!isOk)
                return false;
        }

        auto it = m_txtReader.find(projectTreeChildItem);
        if (it != m_txtReader.end())
        {
            auto _parser = it.value();
            auto _filePath = _parser->GetFileName();
            auto _fileName = _filePath.split("/").last();
            auto _keyName = _parser->getEachColNameOfKey().first();//只有一列
            auto _keyUnit = _parser->getEachColUnitOfKey().first();
            auto _keyData = _parser->getEachColDataOfKey().first();

            auto _valueName = _parser->getEachColNameOfValue().last();//最后一个是Etotal
            auto _valueUnit = _parser->getEachColUnitOfValue().last();
            auto _valueData = _parser->getEachColDataOfValue().last();

            QString _completekeyName;
            // 获取所有x数据值
            _completekeyName = _keyName + "||" + _keyUnit + "||key";
            QVector<QPair<QString, QVector<double>>> datas; // 所有数据数组
            datas.append(qMakePair(_completekeyName, _keyData)); // 添加x数据

            QString _completeValueName = _valueName;
            _completeValueName.append("||V/m");
            _completeValueName.append("||value");
            datas.append(qMakePair(_completeValueName, _valueData));

            if (datas.size() == 1)
            {
                return false;
            }

            QString _newfilePath = dirName + "/" + _fileName;
            QFile file(_newfilePath);
            if (file.open(QIODevice::WriteOnly | QIODevice::Text))
            {
                QTextStream out(&file);
                // 设置 QTextStream 的编码为 UTF-8
                out.setCodec("UTF-8");
                // 可选：写入 BOM，如果需要 Excel 正确识别 UTF-8 BOM
                file.write("\xEF\xBB\xBF");

                out << "# comac datafile version 1.0" << "\n";

                QStringList dataName;
                for (auto iter = datas.begin(); iter != datas.end(); ++iter)
                {
                    dataName.append(iter->first);
                }
                out << "# " + dataName.join(" , ") << "\n";

                int num = datas.first().second.size();
                for (int i = 0; i < num; ++i)
                {
                    QStringList dataValue;
                    for (int j = 0; j < datas.size(); ++j)
                    {
                        const auto& data = datas.at(j);
                        int significantBit = 5;
                        if (j > 0)
                        {
                            significantBit = 8;
                        }
                        dataValue.append(QString::number(data.second.at(i), 'E', significantBit));
                    }
                    out << dataValue.join(" , ") << "\n";
                }
                file.close();
                m_pointElectricFieldData.insert(projectTreeChildItem, _newfilePath);
            }
            else
                return false;
        }
        return true;
          
    }

    void MainWindow::slot_OpenProjectFile(QString filepath)
    {
        auto _reader = new ProjectManager::ProjectFileIO(filepath, ProjectManager::ProjectOperateType::Open);
        _reader->setSavePy(true);
        _reader->startThread();
    }

    void MainWindow::slot_saveProjectData(QString filepath)
    {
        UpdateStatusBarInformation(QStringLiteral("保存工程结果正在进行中..."), true);
        QCoreApplication::processEvents();

        auto _writer = new ProjectManager::ProjectFileIO(filepath, ProjectManager::ProjectOperateType::Save); 
        _writer->setSavePy(true);
        _writer->startThread();
        UpdateStatusBarInformation(QStringLiteral("保存工程结果完成！"), false);
    }

    void MainWindow::slot_clearCurrentProjectAllData()
    {
        m_centerWidget->getTabWidget()->clear();
        m_centerWidget->getTreeView()->model()->removeRows(0, m_centerWidget->getTreeView()->model()->rowCount());
        m_centerWidget->clearData();
        ProjectTreeDataInstance->setTreeView(m_centerWidget->getTreeView());
        ProjectTreeDataInstance->clear();
        WindowTotalDataInstance->clear();
        DataImportConfigurationDataInstance->resetData();
        m_fileType.clear();
        RecycleAllReader();
        m_currentChosenFiles.clear();
        m_optionalKeyList.clear();
        m_errorMessageList.clear();
        m_selectFileList.clear();
        m_farFieldDataGeneratorList.clear();
        m_pyFileTypeList.clear();
        m_pyTextParserList.clear();
        m_pyVtuReaderList.clear();
        m_pyVtkReaderList.clear();
        m_EvaluationSubmissionNodeCorrespondence.clear();
        m_pointElectricFieldData.clear();
        JsonParser::GetInstance()->ClearAllData();
    }

    void MainWindow::slot_ActionHomePage()
    {
        ui->toolBar_HomePage->show();
        ui->toolBar_DataAnalysis->hide();
        ui->toolBar_Display->hide();

        m_actionHomePage->setChecked(true);
        m_actionDataAnalysis->setChecked(false);
        m_actionDisplay->setChecked(false);
    }
    void MainWindow::slot_ActionDataAnalysis()
    {
        ui->toolBar_HomePage->hide();
        ui->toolBar_DataAnalysis->show();
        ui->toolBar_Display->hide();

        m_actionHomePage->setChecked(false);
        m_actionDataAnalysis->setChecked(true);
        m_actionDisplay->setChecked(false);
    }
    void MainWindow::slot_ActionDisplay()
    {
        ui->toolBar_HomePage->hide();
        ui->toolBar_DataAnalysis->hide();
        ui->toolBar_Display->show();

        m_actionHomePage->setChecked(false);
        m_actionDataAnalysis->setChecked(false);
        m_actionDisplay->setChecked(true);
    }

    void MainWindow::slot_toolButtonTranslationClicked(bool checked)
    {
        m_toolButtonTranslation->setChecked(checked);
        if (m_toolButtonRotation->isChecked())
            m_toolButtonRotation->setChecked(false);
    }
    void MainWindow::slot_toolButtonRotationClicked(bool checked)
    {
        m_toolButtonRotation->setChecked(checked);
        if (m_toolButtonTranslation->isChecked())
            m_toolButtonTranslation->setChecked(false);
    }

    // void MainWindow::slot_toolButtonModelDisplay(bool checked)
    //{
    //     m_toolButtonModelDisplay->setChecked(checked);
    //     m_centerWidget->showModel(checked);
    // }

    int MainWindow::getCurrent3DWindowGraphSize()
    {
        auto currentWindow = qobject_cast<Graph3DWindowBase*>(m_centerWidget->getCurrentGraphWindow());
        if (currentWindow!=nullptr)
        {
            return  currentWindow->getInfoList().size();
        }
    }

    void MainWindow::slot_toolButtonActiveClipperStateChanged(bool checked)
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        if (getCurrent3DWindowGraphSize() == 0)
        {
            if (m_toolButtonActiveClipper->isChecked())
            {
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("未读取到有效结果数据"), EDialogMsg::Error, QStringLiteral("失败"), {QStringLiteral("确定")});
            }
            m_toolButtonActiveClipper->setChecked(false);
            return;
        }

        if (m_toolButtonActiveClipper->isChecked())
        {
            m_toolButtonFastBack->setEnabled(false);    // 快退
            m_toolButtonPlay->setEnabled(false);        // 播放
            m_toolButtonFastForward->setEnabled(false); // 快进

            m_animationInfoBarWidgetLeft->setEnabled(false);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(false); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图
        }
        else
        {
            m_toolButtonFastBack->setEnabled(false); // 快退
            // m_toolButtonPlay->setEnabled(m_toolButtonPlay->isEnabled()); // 播放
            slot_updateAnimationButtonState();
            m_toolButtonFastForward->setEnabled(false); // 快进

            m_animationInfoBarWidgetLeft->setEnabled(true);  // 动画信息栏左部分
            m_animationInfoBarWidgetRight->setEnabled(true); // 动画信息栏右部分

            m_toolButtonDynamicType->setEnabled(true);                                // 类型：相机
            m_actionCamera->setEnabled(true);                                         // 类型：相机
            m_actionData->setEnabled(true);                                           // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(true);                             // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(m_toolButtonPlay->isEnabled()); // 导出动图
        }
    }

    void MainWindow::slot_toolButtonPlayStateChanged(bool checked)
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        if (m_toolButtonPlay->isChecked())
        {
            auto window = m_centerWidget->getCurrentGraphWindow();
            if (qobject_cast<Graph3DWindowBase*>(window) != nullptr&& getCurrent3DWindowGraphSize() == 0)
            {
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("未读取到有效结果数据，不可播放"), EDialogMsg::Error, QStringLiteral("失败"), { QStringLiteral("确定") });
                m_toolButtonPlay->setChecked(false);
                return;
            }
            if (qobject_cast<HeatMapWindow*>(window) != nullptr && !qobject_cast<HeatMapWindow*>(window)->whetherCanEnableDataAnimation())
            {
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("未读取到有效结果数据，不可播放"), EDialogMsg::Error, QStringLiteral("失败"), { QStringLiteral("确定") });
                m_toolButtonPlay->setChecked(false);
                return;
            }
        }

        /*
         * 播放时需要禁用右键功能
         */
        auto* current = m_centerWidget->getCurrentGraphWindow();
        if (auto* w = qobject_cast<SurfaceElectricFieldMapWindow*>(current))
        {
            w->slot_stopAddMarker();//并且退出标记
            QVTKOpenGLNativeWidget* qvtkWidget = w->getQvtkWidget();
            if (m_toolButtonPlay->isChecked())
            {
                qvtkWidget->setEnabled(false);
            }
            else
            {
                qvtkWidget->setEnabled(true);
            }
        }
        else if (auto* w = qobject_cast<ThreeDCloudMapWindow*>(current))
        {
            w->slot_stopAddMarker();// 并且退出标记
            QVTKOpenGLNativeWidget* qvtkWidget = w->getQvtkWidget();
            if (m_toolButtonPlay->isChecked())
            {
                qvtkWidget->setEnabled(false);
            }
            else
            {
                qvtkWidget->setEnabled(true);
            }
        }
        else if (auto* w = qobject_cast<ThreeDSurfacePlotWindow*>(current))
        {
            QVTKOpenGLNativeWidget* qvtkWidget = w->getQvtkWidget();
            if (m_toolButtonPlay->isChecked())
            {
                qvtkWidget->setEnabled(false);
            }
            else
            {
                qvtkWidget->setEnabled(true);
            }
        }
        else if (auto* w = qobject_cast<HeatMapWindow*>(current))
        {
            Curve2DPlotor* customPlot = w->getCustomPlot();
            customPlot->slot_exitAddMarkerState();// 并且退出标记
            if (m_toolButtonPlay->isChecked())
            {
                customPlot->setEnabled(false);
            }
            else
            {
                customPlot->setEnabled(true);
            }
        }

        if (m_toolButtonPlay->isChecked())
        {
            m_actionHomePage->setEnabled(false);
            m_actionDataAnalysis->setEnabled(false);

            // 显示按钮
            m_toolButtonSelfAdaptation->setEnabled(false);    // 自适应
            m_toolButtonAmplify->setEnabled(false);           // 放大
            m_toolButtonMinification->setEnabled(false);      // 缩小
            m_toolButtonTranslation->setEnabled(false);       // 平移
            m_toolButtonRotation->setEnabled(false);          // 旋转
            m_toolButtonIsometricView->setEnabled(false);     // 等距视图
            m_toolButtonTopView->setEnabled(false);           // 俯视图
            m_toolButtonUpwardView->setEnabled(false);        // 仰视图
            m_toolButtonFrontView->setEnabled(false);         // 正视图
            m_toolButtonRearView->setEnabled(false);          // 后视图
            m_toolButtonLeftView->setEnabled(false);          // 左视图
            m_toolButtonRightView->setEnabled(false);         // 右视图
            m_toolButtonModelDisplay->setEnabled(false);      // 模型显示
            m_toolButtonActiveClipper->setEnabled(false);     // 剖面
            m_labelNormal->setEnabled(false);                 // 法向
            m_labelLocation->setEnabled(false);               // 位置
            m_labelLocationUnit->setEnabled(false);           // 位置单位
            m_comboBoxClipperNormal->setEnabled(false);       // 法向
            m_lineEditClipperOrigin->setEnabled(false);       // 位置
            m_toolButtonFastBack->setEnabled(true);           // 快退
            m_toolButtonFastForward->setEnabled(true);        // 快进
            m_toolButtonDynamicType->setEnabled(false);       // 类型：相机
            m_actionCamera->setEnabled(false);                // 类型：相机
            m_actionData->setEnabled(false);                  // 类型：相机
            m_toolButtonDynamicSetting->setEnabled(false);    // 动态设置
            m_toolButtonExportMotionGraph->setEnabled(false); // 导出动图
            m_toolButtonThunderstormZone->setEnabled(false);  // 雷电分区
        }
        else
        {
            m_actionHomePage->setEnabled(true);
            m_actionDataAnalysis->setEnabled(true);
            slot_tabBarCurrentChanged();
        }

        auto window = qobject_cast<HeatMapWindow*>(m_centerWidget->getCurrentGraphWindow());
        if (window != nullptr)
        {
            m_actionCamera->setEnabled(false);
        }

        // 播放的时候不允许切换窗口
        checked ? m_centerWidget->getTabWidget()->tabBar()->setEnabled(false) : m_centerWidget->getTabWidget()->tabBar()->setEnabled(true);
        if (checked)
        {
            m_toolButtonPlay->setIcon(QIcon(":/QUI/image/pst_suspend.png"));
            m_toolButtonPlay->setText("暂停");

            m_SubtractSliderPushButton->setEnabled(true);
            // m_sliderAniamtionInfoPosition->setEnabled(true);
            m_AdditionSliderPushButton->setEnabled(true);
        }
        else
        {
            m_toolButtonPlay->setIcon(QIcon(":/QUI/image/pst_play.png"));
            m_toolButtonPlay->setText("播放");
            m_SubtractSliderPushButton->setEnabled(false);
            // m_sliderAniamtionInfoPosition->setEnabled(false);
            m_AdditionSliderPushButton->setEnabled(false);
        }
        m_centerWidget->setTreeViewState(!checked);
        m_menuSignalHandlerInstance->slot_toolButtonPlayClicked(checked);
    }

    void MainWindow::slot_toolButtonSelfAdaptationClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph2DWindowBase* graph2DWindow = qobject_cast<Graph2DWindowBase*>(currentGraph);
        if (graph2DWindow != nullptr)
        {
            graph2DWindow->slot_adaptiveRange();
        }
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setResetCamera();
    }

    void MainWindow::slot_toolButtonIsometricViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToIsometric();
    }

    void MainWindow::slot_toolButtonTopViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToNegativeZ();
    }

    void MainWindow::slot_toolButtonUpwardViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToPositiveZ();
    }

    void MainWindow::slot_toolButtonFrontViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToNegativeX();
    }

    void MainWindow::slot_toolButtonRearViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToPositiveX();
    }

    void MainWindow::slot_toolButtonLeftViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToPositiveY();
    }

    void MainWindow::slot_toolButtonRightViewClicked()
    {
        auto currentGraph = m_centerWidget->getCurrentGraphWindow();
        // 借助slot_checkGraphType判断的按钮是否可用来判断选中数据类型
        Graph3DWindowBase* _window = qobject_cast<Graph3DWindowBase*>(currentGraph);
        if (_window == nullptr)
        {
            return;
        }
        _window->setCameraToNegativeY();
    }

    bool MainWindow::slot_toolButtonModelDisplay()
    {
        if (!getCurrent3DWindowGraphSize())
        {
            return false;
        }
        m_toolButtonModelDisplay->setChecked(m_toolButtonModelDisplay->isChecked());
        bool hasAnyGeometrySuccess = false;

        QWidget* currentGraph = m_centerWidget->getCurrentGraphWindow();
        int windowUniversalID = qobject_cast<Graph3DWindowBase*>(currentGraph)->getWindowUniversalID();
        QStringList _pyCodes{};
        _pyCodes += QString("modeldisplaysetting1 = PostProcessing.ModelDisplaySetting()");
        _pyCodes += QString("modeldisplaysetting1.setWindowUniversalId(%1)").arg((int)windowUniversalID);
        _pyCodes += QString("modeldisplaysetting1.setModelDisplaySettingData(%1,%2,%3)").arg(m_toolButtonActiveClipper->isChecked()).arg(m_toolButtonModelDisplay->isChecked()).arg(hasAnyGeometrySuccess);
        _pyCodes += QString("modeldisplaysetting1.ModelDisplaySettingData()");
        emit IBaseSignalInstance->signal_execPYCode(_pyCodes, true, false);

        m_menuSignalHandlerInstance->slot_updateClipperAndGeometry(
            m_toolButtonActiveClipper->isChecked(), m_toolButtonModelDisplay->isChecked(), hasAnyGeometrySuccess);
        if (!hasAnyGeometrySuccess)
        {
            m_toolButtonModelDisplay->setChecked(false);
            m_menuSignalHandlerInstance->setActiveGeometryState(false);
        }
        return hasAnyGeometrySuccess;
    }

    void MainWindow::slot_SubtractSliderPushButtonClicked()
    {
        m_toolButtonPlay->setChecked(false);
        slot_toolButtonPlayStateChanged(false);
        m_menuSignalHandlerInstance->slot_toolButtonPlayClicked(false);
    }
    void MainWindow::slot_AddSliderPushButtonClicked()
    {
        m_toolButtonPlay->setChecked(false);
        slot_toolButtonPlayStateChanged(false);
        m_menuSignalHandlerInstance->slot_toolButtonPlayClicked(false);
    }
    void MainWindow::slot_SliderPressed()
    {
        // 鼠标按下时，数据停止循环播放
        m_sliderAniamtionIsPressed = true;
        std::cout << "----------------SliderPressed" << std::endl;
    }
    void MainWindow::slot_SliderReleased()
    {
        std::cout << "---------------SliderReleased" << std::endl;
        m_sliderAniamtionIsPressed = false;
        // 鼠标释放时，播放按钮设置初始状态
        m_toolButtonPlay->setChecked(false);
        slot_toolButtonPlayStateChanged(false);
        m_menuSignalHandlerInstance->slot_toolButtonPlayClicked(false);
        // 画面显示滑动条当前位置的帧
    }
    void MainWindow::slot_SliderValueChanged(int value)
    {
        // 判断滑动条是否按下，如果按下再根据当前位置的帧显示画面
        if (m_sliderAniamtionIsPressed)
        {
            std::cout << "----------SliderValueChanged" << std::endl;
        }
    }

    void MainWindow::initMainToolBar()
    {
        ui->menuBar->hide();
        // 工具栏d
        m_actionHomePage = new QToolButton(this);
        m_actionDataAnalysis = new QToolButton(this);
        m_actionDisplay = new QToolButton(this);
        m_actionHomePage->setText("主页");
        m_actionHomePage->setToolButtonStyle(Qt::ToolButtonTextOnly);
        m_actionDataAnalysis->setText("数据分析");
        m_actionDataAnalysis->setToolButtonStyle(Qt::ToolButtonTextOnly);
        m_actionDisplay->setText("显示");
        m_actionDisplay->setToolButtonStyle(Qt::ToolButtonTextOnly);
        m_actionHomePage->setCheckable(true);
        m_actionDataAnalysis->setCheckable(true);
        m_actionDisplay->setCheckable(true);

        ui->mainToolBar->addWidget(m_actionHomePage);
        ui->mainToolBar->addWidget(m_actionDataAnalysis);
        ui->mainToolBar->addWidget(m_actionDisplay);

        ui->mainToolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
        ui->mainToolBar->setAllowedAreas(Qt::NoToolBarArea);
        ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextOnly);
        ui->mainToolBar->setFloatable(false);
        ui->mainToolBar->setMovable(false);
        ui->mainToolBar->setObjectName("pst_mainWindowMainToolBar");
        // 设置样式
        // ui->mainToolBar->setFixedHeight(72);
        ui->mainToolBar->setIconSize(QSize(24, 24));
        connect(m_actionHomePage, &QToolButton::clicked, this, &MainWindow::slot_ActionHomePage);
        connect(m_actionDataAnalysis, &QToolButton::clicked, this, &MainWindow::slot_ActionDataAnalysis);
        connect(m_actionDisplay, &QToolButton::clicked, this, &MainWindow::slot_ActionDisplay);
    }

    void MainWindow::initHomePageToolBar()
    {
        // 创建一个 widget 用于布局
        QWidget* homepageToolbarWidget1 = new QWidget();
        QWidget* homepageToolbarWidget2 = new QWidget();
        QVBoxLayout* homepageToolbarLayout1 = new QVBoxLayout(homepageToolbarWidget1);
        QVBoxLayout* homepageToolbarLayout2 = new QVBoxLayout(homepageToolbarWidget2);
        // homepageToolbarWidget1->setContentsMargins(0, 0, 0, 0);
        // homepageToolbarWidget2->setContentsMargins(0, 0, 0, 0);
        homepageToolbarLayout1->setMargin(0);
        // homepageToolbarLayout1->addStretch();
        homepageToolbarLayout2->setMargin(0);
        // homepageToolbarLayout2->addStretch();
        ui->toolBar_HomePage->setFixedHeight(72);
        ui->toolBar_HomePage->setObjectName("pst_mainWindowHomePageToolBar");
        QToolButton* toolButtonOpenProjectFile = new QToolButton(this);
        // toolButtonOpenProjectFile->setElaIcon(ElaIconType::ArrowDownToBracket);
        toolButtonOpenProjectFile->setIcon(QIcon(":/QUI/image/pst_projectResult_import.png"));
        toolButtonOpenProjectFile->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        toolButtonOpenProjectFile->setText("打开工程文件");
        toolButtonOpenProjectFile->setObjectName("pst_toolBarMinToolButton");
        // toolButtonOpenProjectFile->setEnabled(false);
        homepageToolbarLayout1->addWidget(toolButtonOpenProjectFile);

        QToolButton* toolButtonProjectResultSave = new QToolButton(this);
        toolButtonProjectResultSave->setIcon(QIcon(":/QUI/image/pst_projectResultSave.png"));
        toolButtonProjectResultSave->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        toolButtonProjectResultSave->setText("保存工程文件");
        toolButtonProjectResultSave->setObjectName("pst_toolBarMinBottomToolButton");
        // toolButtonProjectResultSave->setEnabled(false);
        homepageToolbarLayout1->addWidget(toolButtonProjectResultSave);
        // homepageToolbarLayout1->addStretch();
        ui->toolBar_HomePage->addWidget(homepageToolbarWidget1);

        QToolButton* toolButtonDataImport = new QToolButton(this);
        // toolButton1->setElaIcon(ElaIconType::FileImport);
        toolButtonDataImport->setIcon(QIcon(":/QUI/image/pst_data_import.png"));
        toolButtonDataImport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        toolButtonDataImport->setText("导入数据");
        toolButtonDataImport->setObjectName("pst_toolBarMinToolButton");
        homepageToolbarLayout2->addWidget(toolButtonDataImport);
        connect(toolButtonDataImport, &QToolButton::clicked, [this]()
                { m_menuSignalHandlerInstance->slot_toolButtonDataImport(m_lastSelectPath); });

        QToolButton* toolButtonDataExport = new QToolButton(this);
        // toolButton2->setElaIcon(ElaIconType::FileExport);
        toolButtonDataExport->setIcon(QIcon(":/QUI/image/pst_data_export.png"));
        toolButtonDataExport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        toolButtonDataExport->setText("导出数据");
        toolButtonDataExport->setObjectName("pst_toolBarMinBottomToolButton");
        // toolButton2->setEnabled(false);
        homepageToolbarLayout2->addWidget(toolButtonDataExport);
        // homepageToolbarLayout2->addStretch();
        ui->toolBar_HomePage->addWidget(homepageToolbarWidget2);

        QToolButton* toolButtonOpenSimulationData = new QToolButton(this);
        // toolButtonOpenSimulationData->setElaIcon(ElaIconType::ArrowDownToBracket);
        toolButtonOpenSimulationData->setIcon(QIcon(":/QUI/image/pst_OpenSimulationData.png"));
        toolButtonOpenSimulationData->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonOpenSimulationData->setText("打开仿真数据");
        //toolButtonOpenSimulationData->setObjectName("pst_toolBarMinToolButton");
        // toolButtonOpenSimulationData->setEnabled(false);
        ui->toolBar_HomePage->addWidget(toolButtonOpenSimulationData);

        connect(toolButtonDataExport, &QToolButton::clicked, this, &MainWindow::slot_exportBtnClick);

        ui->toolBar_HomePage->addSeparator();

        m_toolButton2DGraph = new QToolButton(this);
        m_toolButton2DGraph->setIcon(QIcon(":/QUI/image/pst_2d_graph.png"));
        m_toolButton2DGraph->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButton2DGraph->setText("二维折线图");
        m_toolButton2DGraph->setEnabled(false);
        ui->toolBar_HomePage->addWidget(m_toolButton2DGraph);
        ui->toolBar_HomePage->setMovable(false);

        m_toolButtonPolarGraph = new QToolButton(this);
        m_toolButtonPolarGraph->setIcon(QIcon(":/QUI/image/pst_polar_graph.png"));
        m_toolButtonPolarGraph->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonPolarGraph->setText("极坐标图");
        m_toolButtonPolarGraph->setEnabled(false);
        ui->toolBar_HomePage->addWidget(m_toolButtonPolarGraph);

        m_toolButtonTwoDHeatMap = new QToolButton(this);
        m_toolButtonTwoDHeatMap->setIcon(QIcon(":/QUI/image/pst_twoDHeatMap.png"));
        m_toolButtonTwoDHeatMap->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonTwoDHeatMap->setText("二维热力图");
        m_toolButtonTwoDHeatMap->setEnabled(false);
        // m_toolButtonTwoDHeatMap->setVisible(false);
        ui->toolBar_HomePage->addWidget(m_toolButtonTwoDHeatMap);

        // auto _toolButtonPeaksAndTroughs = new QToolButton(this);
        //_toolButtonPeaksAndTroughs->setIcon(QIcon(":/QUI/image/pst_peaksAndTroughs.png"));
        //_toolButtonPeaksAndTroughs->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        //_toolButtonPeaksAndTroughs->setText("波峰波谷图");
        // ui->toolBar_HomePage->addWidget(_toolButtonPeaksAndTroughs);

        m_toolButton3DCloudMap = new QToolButton(this);
        m_toolButton3DCloudMap->setIcon(QIcon(":/QUI/image/pst_3DCloudMap.png"));
        m_toolButton3DCloudMap->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButton3DCloudMap->setEnabled(false);
        m_toolButton3DCloudMap->setText("三维云图");
        // m_toolButton3DCloudMap->setEnabled(false);
        // m_toolButton3DCloudMap->setVisible(false);
        ui->toolBar_HomePage->addWidget(m_toolButton3DCloudMap);

        m_toolButton3DSurfacePlot = new QToolButton(this);
        m_toolButton3DSurfacePlot->setIcon(QIcon(":/QUI/image/pst_3DSurfacePlot.png"));
        m_toolButton3DSurfacePlot->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButton3DSurfacePlot->setEnabled(false);
        m_toolButton3DSurfacePlot->setText("三维曲面图");
        // m_toolButton3DSurfacePlot->setEnabled(false);
        // m_toolButtonTwoDHeatMap->setVisible(false);
        ui->toolBar_HomePage->addWidget(m_toolButton3DSurfacePlot);

        m_toolButtonSurfaceElectricFieldMap = new QToolButton(this);
        m_toolButtonSurfaceElectricFieldMap->setIcon(QIcon(":/QUI/image/pst_surfaceElectricFieldMap.png"));
        m_toolButtonSurfaceElectricFieldMap->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonSurfaceElectricFieldMap->setText("表面分布图");
        m_toolButtonSurfaceElectricFieldMap->setEnabled(false);
        ui->toolBar_HomePage->addWidget(m_toolButtonSurfaceElectricFieldMap);

        m_toolButtonTable = new QToolButton(this);
        m_toolButtonTable->setIcon(QIcon(":/QUI/image/pst_data_table.png"));
        m_toolButtonTable->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonTable->setText("数据表格");
        m_toolButtonTable->setEnabled(false);
        ui->toolBar_HomePage->addWidget(m_toolButtonTable);

        ui->toolBar_HomePage->addSeparator();

        m_toolButtonFormatView = new QToolButton(this);
        m_toolButtonFormatView->setIcon(QIcon(":/QUI/image/pst_standard_format_view.png"));
        m_toolButtonFormatView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonFormatView->setText("标准显示");
        // toolButtonFormatView->setEnabled(false);
        ui->toolBar_HomePage->addWidget(m_toolButtonFormatView);

        QWidget* homepageToolbarWidget3 = new QWidget();
        auto _gridLayout = new QGridLayout(homepageToolbarWidget3);

        m_labelStandardSelection = new QLabel(this);
        m_labelStandardSelection->setText("标准选择");
        // m_labelStandardSelection->setEnabled(false);
        _gridLayout->addWidget(m_labelStandardSelection, 0, 0);
        m_comboBoxStandardSelection = new QComboBox(this);
        m_comboBoxStandardSelection->setView(new QListView());
        // 插入数据 用于测试
        //_comboBoxStandardSelection->addItem("FAA AC25-35A");
        //_comboBoxStandardSelection->addItem("FAA AC25-35B");
        //_comboBoxStandardSelection->setEnabled(false);
        _gridLayout->addWidget(m_comboBoxStandardSelection, 0, 1);

        m_labelDataSelection = new QLabel(this);
        m_labelDataSelection->setText("选择数据");
        // m_labelDataSelection->setEnabled(false);
        _gridLayout->addWidget(m_labelDataSelection, 1, 0);
        m_comboBoxDataSelection = new QComboBox(this);
        m_comboBoxDataSelection->setView(new QListView());
        // 插入数据 用于测试
        //_comboBoxDataSelection->addItem("XXXXXXXX");
        //_comboBoxDataSelection->addItem("YYYYYYYY");
        _gridLayout->addWidget(m_comboBoxDataSelection, 1, 1);
        ui->toolBar_HomePage->addWidget(homepageToolbarWidget3);

        ui->toolBar_HomePage->addSeparator();

        // QToolButton* toolButton8 = new QToolButton(this);
        // toolButton8->setElaIcon(ElaIconType::PresentationScreen);
        ////toolButton8->setIcon(QIcon(":/QUI/image/pst_data_import.png"));
        // toolButton8->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        // toolButton8->setText("截图");
        // toolButton8->setEnabled(false);
        // toolBar->addWidget(toolButton8);

        QWidget* homepageToolbarWidget4 = new QWidget();
        QVBoxLayout* homepageToolbarLayout4 = new QVBoxLayout(homepageToolbarWidget4);
        homepageToolbarLayout4->setMargin(0);
        m_toolButtonScreenshotToReport = new QToolButton(this);
        // toolButton9->setElaIcon(ElaIconType::SquarePollHorizontal);
        m_toolButtonScreenshotToReport->setIcon(QIcon(":/QUI/image/pst_screenshot_to_report.png"));
        m_toolButtonScreenshotToReport->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        m_toolButtonScreenshotToReport->setText("截图至报告");
        m_toolButtonScreenshotToReport->setObjectName("pst_toolBarMinToolButton");
        // m_toolButtonScreenshotToReport->setEnabled(false);
        homepageToolbarLayout4->addWidget(m_toolButtonScreenshotToReport);

        m_toolButtonSaveImageToLocal = new QToolButton(this);
        // m_toolButtonSaveImageToLocal->setElaIcon(ElaIconType::Image);
        m_toolButtonSaveImageToLocal->setIcon(QIcon(":/QUI/image/pst_image_save.png"));
        m_toolButtonSaveImageToLocal->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        m_toolButtonSaveImageToLocal->setText("保存图片");
        m_toolButtonSaveImageToLocal->setObjectName("pst_toolBarMinBottomToolButton");
        homepageToolbarLayout4->addWidget(m_toolButtonSaveImageToLocal);
        ui->toolBar_HomePage->addWidget(homepageToolbarWidget4);
        // this->addToolBar(Qt::TopToolBarArea, toolBar);

        QToolButton* toolButtonGenerateReport = new QToolButton(this);
        toolButtonGenerateReport->setIcon(QIcon(":/QUI/image/GenerateReport_CreateNewReport2x.png"));
        toolButtonGenerateReport->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonGenerateReport->setText("生成报告");
        ui->toolBar_HomePage->addWidget(toolButtonGenerateReport);

        ui->toolBar_HomePage->addSeparator();

        QToolButton* toolButtonSaveScript = new QToolButton(this);
        toolButtonSaveScript->setIcon(QIcon(":/QUI/image/pst_SaveScript.png"));
        toolButtonSaveScript->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonSaveScript->setText("保存脚本");
        // toolButtonSaveScript->setObjectName("pst_toolBarMinToolButton");
        // toolButtonSaveScript->setEnabled(false);
        ui->toolBar_HomePage->addWidget(toolButtonSaveScript);

        QToolButton* toolButtonEditScript = new QToolButton(this);
        toolButtonEditScript->setIcon(QIcon(":/QUI/image/pst_EditScript.png"));
        toolButtonEditScript->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonEditScript->setText("编辑脚本");
        // toolButtonEditScript->setObjectName("pst_toolBarMinToolButton");
        // toolButtonEditScript->setEnabled(false);
        ui->toolBar_HomePage->addWidget(toolButtonEditScript);

        QToolButton* toolButtonOperationScript = new QToolButton(this);
        toolButtonOperationScript->setIcon(QIcon(":/QUI/image/pst_RunScript.png"));
        toolButtonOperationScript->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonOperationScript->setText("运行脚本");
        // toolButtonOperationScript->setObjectName("pst_toolBarMinToolButton");
        // toolButtonOperationScript->setEnabled(false);
        ui->toolBar_HomePage->addWidget(toolButtonOperationScript);

        // ui->toolBar_HomePage->addSeparator();

        // QToolButton* toolButtonAIQA = new QToolButton(this);
        // toolButtonAIQA->setIcon(QIcon(":/QUI/image/pst_AIQA.png"));
        // toolButtonAIQA->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        // toolButtonAIQA->setText("AI问答");
        // ui->toolBar_HomePage->addWidget(toolButtonAIQA);

        connect(m_toolButton2DGraph, &QToolButton::clicked, [this]()
                {
                m_2DPlotType = FileDataType::File2DCurve; slot_displayNew2DGraph(true); });
        connect(m_toolButtonTwoDHeatMap, &QToolButton::clicked, [this]()
                {
                m_2DPlotType = FileDataType::FileTwoDHeatMap; slot_displayNew2DGraph(true); });
        connect(m_toolButtonPolarGraph, &QToolButton::clicked, [this]()
                {
                m_2DPlotType = FileDataType::FilePolar; slot_displayNew2DGraph(true); });
        connect(m_toolButtonSaveImageToLocal, &QToolButton::clicked, this, &MainWindow::slot_saveGraphToLocal);
        // connect(toolButtonProjectResultImport, &QToolButton::clicked, this, &MainWindow::slot_importProjectData);
        connect(toolButtonOpenSimulationData, &QToolButton::clicked, this, &MainWindow::slot_importProjectData);
        connect(toolButtonOpenProjectFile, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonOpenProjectFile);
        connect(toolButtonProjectResultSave, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonProjectResultSave);
        connect(m_toolButtonSurfaceElectricFieldMap, &QToolButton::clicked, [this]() {
            slot_displayNewSurfaceElectricFieldGraph(true);}) ;
        connect(m_toolButton3DCloudMap, &QToolButton::clicked, [this]()
                { slot_displayNewThreeDCloudMap(true); });
        connect(m_toolButton3DSurfacePlot, &QToolButton::clicked, [this]()
                { slot_displayNewThreeDSurfacePlot(true); });
        connect(m_toolButtonTable, &QToolButton::clicked, this, &MainWindow::slot_displayInTableWidget);
        connect(m_toolButtonScreenshotToReport, &QToolButton::clicked, this, &MainWindow::slot_screenshootToReport);
        connect(toolButtonGenerateReport, &QToolButton::clicked, this, &MainWindow::slot_openReportModel);
        // connect(_toolButtonPeaksAndTroughs, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonPeaksAndTroughsClicked);

        connect(m_toolButtonFormatView, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonFormatViewClicked);
        connect(m_comboBoxStandardSelection, QOverload<int>::of(&QComboBox::currentIndexChanged), m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_comboBoxStandardSelectionCurrentIndexChanged);
        connect(m_comboBoxDataSelection, QOverload<int>::of(&QComboBox::currentIndexChanged), m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_comboBoxDataSelectionCurrentIndexChanged);
        // connect(toolButtonDataImport, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonDataImportClicked);
        // connect(toolButtonDataExport, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonDataExportClicked);
        connect(toolButtonSaveScript, &QToolButton::clicked, this, &MainWindow::slot_saveScript);
        connect(toolButtonEditScript, &QToolButton::clicked, this, &MainWindow::slot_editScript);
        connect(toolButtonOperationScript, &QToolButton::clicked, this, &MainWindow::slot_operationScript);
        // connect(toolButtonAIQA, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonAIQAClicked);

        QShortcut* shortcut = new QShortcut(QKeySequence("Ctrl+R"), this);
        connect(shortcut, &QShortcut::activated, this, &MainWindow::slot_operationScript);

        QShortcut* shortcutSaveScript = new QShortcut(QKeySequence("Ctrl+S"), this);
        connect(shortcutSaveScript, &QShortcut::activated, this, &MainWindow::slot_saveScript);
    }

    void MainWindow::initDataAnalysisToolBar()
    {
        ui->toolBar_DataAnalysis->setObjectName("pst_mainWindowDataAnalysisToolBar");
        ui->toolBar_DataAnalysis->setFixedHeight(72);

        // m_toolButtonTotalQuantityCalculation = new QToolButton(this);
        // m_toolButtonTotalQuantityCalculation->setIcon(QIcon(":/QUI/image/pst_Etotal.png"));
        // m_toolButtonTotalQuantityCalculation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        // m_toolButtonTotalQuantityCalculation->setText("总量计算");
        // ui->toolBar_DataAnalysis->addWidget(m_toolButtonTotalQuantityCalculation);

        m_toolButtonHirfExtrapolation = new QToolButton(this);
        m_toolButtonHirfExtrapolation->setIcon(QIcon(":/QUI/image/pst_hirfExtrapolation.png"));
        m_toolButtonHirfExtrapolation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonHirfExtrapolation->setText("HIRF外推");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonHirfExtrapolation);

        //--------以下功能该版本隐藏0408---------
        // QWidget* dataAnalysisToolbarWidget = new QWidget();
        // auto _gridLayout = new QGridLayout(dataAnalysisToolbarWidget);
        //_gridLayout->setMargin(0);
        // m_toolButtonLightningZoning = new QToolButton(this);
        // m_toolButtonLightningZoning->setIcon(QIcon(":/QUI/image/pst_lightningZoning.png"));
        // m_toolButtonLightningZoning->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        // m_toolButtonLightningZoning->setText("雷电分区");
        // ui->toolBar_DataAnalysis->addWidget(m_toolButtonLightningZoning);
        //--------以上功能该版本隐藏0408---------

        m_toolButtonShieldingEfficiency = new QToolButton(this);
        m_toolButtonShieldingEfficiency->setIcon(QIcon(":/QUI/image/pst_ShieldingEfficiency.png"));
        m_toolButtonShieldingEfficiency->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonShieldingEfficiency->setText("屏蔽效能");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonShieldingEfficiency);

        m_toolButtonThunderstormZone = new QToolButton(this);
        m_toolButtonThunderstormZone->setIcon(QIcon(":/QUI/image/pst_lightningZoning.png"));
        m_toolButtonThunderstormZone->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonThunderstormZone->setText("雷电分区");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonThunderstormZone);

        m_toolButtonTransferFunction = new QToolButton(this);
        m_toolButtonTransferFunction->setIcon(QIcon(":/QUI/image/pst_TransferFunction.png"));
        m_toolButtonTransferFunction->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonTransferFunction->setText("传递函数");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonTransferFunction);

        m_toolButtonIPLCalculation = new QToolButton(this);
        m_toolButtonIPLCalculation->setIcon(QIcon(":/QUI/image/pst_IPLCalculation.png"));
        m_toolButtonIPLCalculation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonIPLCalculation->setText("IPL计算");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonIPLCalculation);

        m_toolButtonWaveformAnalysis = new QToolButton(this);
        m_toolButtonWaveformAnalysis->setIcon(QIcon(":/QUI/image/pst_waveformAnalysis.png"));
        m_toolButtonWaveformAnalysis->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonWaveformAnalysis->setText("波形分析");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonWaveformAnalysis);

        ui->toolBar_DataAnalysis->addSeparator();

        //-------------以下功能在此版本暂时隐藏0331-------------
        /*
        QToolButton* toolButtonFFT = new QToolButton(this);
        toolButtonFFT->setIcon(QIcon(":/QUI/image/pst_FFT.png"));
        toolButtonFFT->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonFFT->setText("FFT");
        ui->toolBar_DataAnalysis->addWidget(toolButtonFFT);

        QToolButton* toolButtonBasicAnalysis = new QToolButton(this);
        toolButtonBasicAnalysis->setIcon(QIcon(":/QUI/image/pst_basicAnalysis.png"));
        toolButtonBasicAnalysis->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonBasicAnalysis->setText("基本分析");
        ui->toolBar_DataAnalysis->addWidget(toolButtonBasicAnalysis);

        QToolButton* toolButtonCorrelationAnalysis = new QToolButton(this);
        toolButtonCorrelationAnalysis->setIcon(QIcon(":/QUI/image/pst_correlationAnalysis.png"));
        toolButtonCorrelationAnalysis->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonCorrelationAnalysis->setText("相关性分析");
        ui->toolBar_DataAnalysis->addWidget(toolButtonCorrelationAnalysis);

        QToolButton* toolButtonCumulativeDistributionFunction = new QToolButton(this);
        toolButtonCumulativeDistributionFunction->setIcon(QIcon(":/QUI/image/pst_cumulativeDistributionFunction.png"));
        toolButtonCumulativeDistributionFunction->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        toolButtonCumulativeDistributionFunction->setText("累积分布函数");
        ui->toolBar_DataAnalysis->addWidget(toolButtonCumulativeDistributionFunction);

        ui->toolBar_DataAnalysis->addSeparator();
        */
        //----------以上功能在此版本暂时隐藏0331-----------

        m_toolButtonCurveSmoothing = new QToolButton(this);
        m_toolButtonCurveSmoothing->setIcon(QIcon(":/QUI/image/pst_curveSmoothing.png"));
        m_toolButtonCurveSmoothing->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonCurveSmoothing->setText("曲线平滑");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonCurveSmoothing);

        m_toolButtonInterpolation = new QToolButton(this);
        m_toolButtonInterpolation->setIcon(QIcon(":/QUI/image/pst_interpolation.png"));
        m_toolButtonInterpolation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonInterpolation->setText("插值");
        m_toolButtonInterpolation->setPopupMode(QToolButton::InstantPopup);
        m_toolButtonInterpolation->setObjectName("pst_DropDownToolbutton");
        QMenu* menuInterpolation = new QMenu(this);
        m_linearInterpolation = menuInterpolation->addAction("线性插值");
        m_logarithmicInterpolationSingleAxisX = menuInterpolation->addAction("单X轴对数插值");
        m_logarithmicInterpolationSingleAxisY = menuInterpolation->addAction("单Y轴对数插值");
        m_logarithmicInterpolationDoubleAxis = menuInterpolation->addAction("双对数轴对数插值");
        // m_splineInterpolation = menuInterpolation->addAction("样条插值");
        // m_polynomialInterpolation = menuInterpolation->addAction("多项式插值");
        m_toolButtonInterpolation->setMenu(menuInterpolation);
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonInterpolation);
        connect(m_toolButtonInterpolation, &QToolButton::triggered, this, [this](QAction* action)
            {
                emit IWidgetSignalInstance->signal_exitAddMarkerState();
            });

        m_toolButtonMeasure = new QToolButton(this);
        m_toolButtonMeasure->setIcon(QIcon(":/QUI/image/pst_ParameterMeasurement.png"));
        m_toolButtonMeasure->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonMeasure->setText("参数测量");
        QMenu* menu = new QMenu(this);
        m_standingWaveBandwidth = menu->addAction(getMeasureTypeName(MeasureType::StandingWaveBandwidth));
        m_standingWaveBandwidth->setData(static_cast<int>(MeasureType::StandingWaveBandwidth));
        m_actionHalfPowerBeamWidth = menu->addAction(getMeasureTypeName(MeasureType::HalfPowerBeamWidth));
        m_actionHalfPowerBeamWidth->setData(static_cast<int>(MeasureType::HalfPowerBeamWidth));
        m_MaxValue = menu->addAction(getMeasureTypeName(MeasureType::MaxValue));
        m_MaxValue->setData(static_cast<int>(MeasureType::MaxValue));
        m_MinValue = menu->addAction(getMeasureTypeName(MeasureType::MinValue));
        m_MinValue->setData(static_cast<int>(MeasureType::MinValue));
        m_AverageValue = menu->addAction(getMeasureTypeName(MeasureType::AverageValue));
        m_AverageValue->setData(static_cast<int>(MeasureType::AverageValue));
        m_toolButtonMeasure->setMenu(menu);
        m_toolButtonMeasure->setPopupMode(QToolButton::InstantPopup);
        m_toolButtonMeasure->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonMeasure->setObjectName("pst_DropDownToolbutton");
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonMeasure);
        ui->toolBar_DataAnalysis->setMovable(false);

        m_toolButtonEvaluationSubmission = new QToolButton(this);
        m_toolButtonEvaluationSubmission->setIcon(QIcon(":/QUI/image/pst_data_export.png"));
        m_toolButtonEvaluationSubmission->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonEvaluationSubmission->setText("评估提交");
        m_toolButtonEvaluationSubmission->setEnabled(true);//按北航汪正梅需求，按钮常亮
        ui->toolBar_DataAnalysis->addWidget(m_toolButtonEvaluationSubmission);

        connect(m_toolButtonMeasure, &QToolButton::triggered, this, [this](QAction* action)
                {
                emit IWidgetSignalInstance->signal_exitAddMarkerState();
                MeasureType meaureType = static_cast<MeasureType>(action->data().toInt());
                if (meaureType == MeasureType::StandingWaveBandwidth)
                {
                    IdaDialogFrame* dialog = new IdaDialogFrame(this);
                    auto dialogCurveSmoothing = new Ui::DialogCurveSmoothing();
                    dialogCurveSmoothing->setupUi(dialog);
                    dialogCurveSmoothing->label->setText("带宽限值:");
                    dialogCurveSmoothing->label_2->hide();
                    dialogCurveSmoothing->doubleSpinBox->setValue(1.5);
                    dialogCurveSmoothing->doubleSpinBox->setDecimals(9);
                    dialogCurveSmoothing->doubleSpinBox->setMinimum(-999999);
                    dialogCurveSmoothing->doubleSpinBox->setFixedSize(QSize(170, 24));
                    IdaWidgetHelperInstance->setMainButtonStyle(dialogCurveSmoothing->pushButton_confirm); // 将确定设置为主按钮
                    dialog->setWindowTitle(tr("驻波带宽"));
                    dialog->showWindow();
                    connect(dialogCurveSmoothing->pushButton_confirm, &QPushButton::clicked, [this, meaureType, dialogCurveSmoothing, dialog]() {
                        m_menuSignalHandlerInstance->slot_measureButtonClicked(meaureType, dialogCurveSmoothing->doubleSpinBox->value());

                        int meaureTypeInt = static_cast<int>(meaureType);
                        QString _pyCode = QString("PostProcessing.lineChartMeasureButtonClicked(%1, %2)").arg(meaureTypeInt).arg(dialogCurveSmoothing->doubleSpinBox->value());
                        emit IBaseSignalInstance->signal_execPYCode(QStringList{_pyCode}, true, false);
                        dialog->close();
                        });
                    connect(dialogCurveSmoothing->pushButton_cancel, &QPushButton::clicked, [this, dialog]()
                        {
                            dialog->close();
                        });
                }
                else
                {
                    m_menuSignalHandlerInstance->slot_measureButtonClicked(meaureType);
                    int meaureTypeInt = static_cast<int>(meaureType);
                    QString _pyCode = QString("PostProcessing.lineChartMeasureButtonClicked(%1, %2)").arg(meaureTypeInt).arg(0);
                    emit IBaseSignalInstance->signal_execPYCode(QStringList{_pyCode}, true, false);
                } });

        // connect(m_toolButtonTotalQuantityCalculation, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonTotalQuantityCalculation);
        connect(m_toolButtonHirfExtrapolation, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonHirfExtrapolationClicked);
        connect(m_toolButtonIPLCalculation, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonIPLCalculationClicked);
        connect(m_toolButtonWaveformAnalysis, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonWaveformAnalysisClicked);
        // connect(m_toolButtonLightningZoning, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonLightningZoningClicked);
        connect(m_toolButtonShieldingEfficiency, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonShieldingEfficiencyClicked);
        connect(m_toolButtonThunderstormZone, &QToolButton::clicked, this, &MainWindow::slot_toolButtonThunderstormZoneClicked);
        connect(m_toolButtonTransferFunction, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonTransferFunctionClicked);

        //-------------以下功能在此版本暂时隐藏0331-------------
        // connect(toolButtonFFT, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonFFTClicked);
        // connect(toolButtonBasicAnalysis, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonBasicAnalysisClicked);
        // connect(toolButtonCorrelationAnalysis, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonCorrelationAnalysisClicked);
        // connect(toolButtonCumulativeDistributionFunction, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonCumulativeDistributionFunctionClicked);
        //-------------以上功能在此版本暂时隐藏0331-------------

        connect(m_toolButtonCurveSmoothing, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonCurveSmoothingClicked);
        connect(m_linearInterpolation, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonLinearInterpolationClicked);
        connect(m_logarithmicInterpolationSingleAxisX, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonLogarithmicInterpolationSingleAxisXClicked);
        connect(m_logarithmicInterpolationSingleAxisY, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonLogarithmicInterpolationSingleAxisYClicked);
        connect(m_logarithmicInterpolationDoubleAxis, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonLogarithmicInterpolationDoubleAxisClicked);
        // connect(m_splineInterpolation, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonSplineInterpolationClicked);
        // connect(m_polynomialInterpolation, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonPolynomialInterpolationClicked);
        connect(m_toolButtonEvaluationSubmission, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonEvaluationSubmission);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_lineChartComputeEffectiveness, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonShieldingEfficiencyClickedFormCommad);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_lineChartComputeHIRF, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_computeHIRF);
        

        // for (auto action : menu->actions())
        //{
        //     connect(action, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_measureButtonClicked);
        // }
    }
    void MainWindow::initDisplayToolBar()
    {
        ui->toolBar_Display->setObjectName("pst_mainWindowDisplayToolBar");
        ui->toolBar_Display->setFixedHeight(72);
        m_toolButtonSelfAdaptation = new QToolButton(this);
        m_toolButtonSelfAdaptation->setIcon(QIcon(":/QUI/image/pst_self-adaptation.png"));
        m_toolButtonSelfAdaptation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonSelfAdaptation->setText("自适应");
        ui->toolBar_Display->addWidget(m_toolButtonSelfAdaptation);

        m_toolButtonAmplify = new QToolButton(this);
        m_toolButtonAmplify->setIcon(QIcon(":/QUI/image/pst_amplify.png"));
        m_toolButtonAmplify->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonAmplify->setText("放大");
        ui->toolBar_Display->addWidget(m_toolButtonAmplify);

        m_toolButtonMinification = new QToolButton(this);
        m_toolButtonMinification->setIcon(QIcon(":/QUI/image/pst_minification.png"));
        m_toolButtonMinification->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonMinification->setText("缩小");
        ui->toolBar_Display->addWidget(m_toolButtonMinification);
        ui->toolBar_Display->addSeparator();

        m_toolButtonTranslation = new QToolButton(this);
        m_toolButtonTranslation->setIcon(QIcon(":/QUI/image/pst_translation.png"));
        m_toolButtonTranslation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonTranslation->setText("平移");
        m_toolButtonTranslation->setCheckable(true);
        m_toolButtonTranslation->setObjectName("pst_toolButtonHoldState");
        ui->toolBar_Display->addWidget(m_toolButtonTranslation);

        m_toolButtonRotation = new QToolButton(this);
        m_toolButtonRotation->setIcon(QIcon(":/QUI/image/pst_rotation.png"));
        m_toolButtonRotation->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonRotation->setText("旋转");
        m_toolButtonRotation->setCheckable(true);
        m_toolButtonRotation->setObjectName("pst_toolButtonHoldState");
        ui->toolBar_Display->addWidget(m_toolButtonRotation);
        ui->toolBar_Display->addSeparator();

        m_toolButtonIsometricView = new QToolButton(this);
        m_toolButtonIsometricView->setIcon(QIcon(":/QUI/image/pst_isometricView.png"));
        m_toolButtonIsometricView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonIsometricView->setText("等距视图");
        m_toolButtonIsometricView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonIsometricView);

        m_toolButtonTopView = new QToolButton(this);
        m_toolButtonTopView->setIcon(QIcon(":/QUI/image/pst_topView.png"));
        m_toolButtonTopView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonTopView->setText("俯视图");
        m_toolButtonTopView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonTopView);

        m_toolButtonUpwardView = new QToolButton(this);
        m_toolButtonUpwardView->setIcon(QIcon(":/QUI/image/pst_upwardView.png"));
        m_toolButtonUpwardView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonUpwardView->setText("仰视图");
        m_toolButtonUpwardView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonUpwardView);

        m_toolButtonFrontView = new QToolButton(this);
        m_toolButtonFrontView->setIcon(QIcon(":/QUI/image/pst_frontView.png"));
        m_toolButtonFrontView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonFrontView->setText("正视图");
        m_toolButtonFrontView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonFrontView);

        m_toolButtonRearView = new QToolButton(this);
        m_toolButtonRearView->setIcon(QIcon(":/QUI/image/pst_rearView.png"));
        m_toolButtonRearView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonRearView->setText("后视图");
        m_toolButtonRearView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonRearView);

        m_toolButtonLeftView = new QToolButton(this);
        m_toolButtonLeftView->setIcon(QIcon(":/QUI/image/pst_leftView.png"));
        m_toolButtonLeftView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonLeftView->setText("左视图");
        m_toolButtonLeftView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonLeftView);

        m_toolButtonRightView = new QToolButton(this);
        m_toolButtonRightView->setIcon(QIcon(":/QUI/image/pst_rightView.png"));
        m_toolButtonRightView->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonRightView->setText("右视图");
        m_toolButtonRightView->setEnabled(true);
        ui->toolBar_Display->addWidget(m_toolButtonRightView);
        ui->toolBar_Display->addSeparator();

        m_toolButtonModelDisplay = new QToolButton(this);
        m_toolButtonModelDisplay->setIcon(QIcon(":/QUI/image/pst_ModelDisplay.png"));
        m_toolButtonModelDisplay->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonModelDisplay->setText("显示模型");
        m_toolButtonModelDisplay->setCheckable(true);
        m_toolButtonModelDisplay->setObjectName("pst_toolButtonHoldState");
        ui->toolBar_Display->addWidget(m_toolButtonModelDisplay);

        m_toolButtonActiveClipper = new QToolButton(this);
        m_toolButtonActiveClipper->setIcon(QIcon(":/QUI/image/pst_profile.png"));
        m_toolButtonActiveClipper->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonActiveClipper->setText("剖面");
        m_toolButtonActiveClipper->setCheckable(true);
        ui->toolBar_Display->addWidget(m_toolButtonActiveClipper);

        QWidget* displayToolbarWidget = new QWidget();
        auto _gridLayout = new QGridLayout(displayToolbarWidget);

        m_labelNormal = new QLabel(this);
        m_labelNormal->setText("法向");
        _gridLayout->addWidget(m_labelNormal, 0, 0);
        m_comboBoxClipperNormal = new PostComboBox(this);
        m_comboBoxClipperNormal->setView(new QListView());
        QSizePolicy comboBoxPolicy = m_comboBoxClipperNormal->sizePolicy();
        comboBoxPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
        comboBoxPolicy.setVerticalPolicy(QSizePolicy::Fixed);
        m_comboBoxClipperNormal->setSizePolicy(comboBoxPolicy);
        m_comboBoxClipperNormal->setFixedSize(QSize(80, 24));
        // 插入数据 用于测试
        m_comboBoxClipperNormal->addItem("X");
        m_comboBoxClipperNormal->addItem("Y");
        m_comboBoxClipperNormal->addItem("Z");
        m_comboBoxClipperNormal->addItem("-X");
        m_comboBoxClipperNormal->addItem("-Y");
        m_comboBoxClipperNormal->addItem("-Z");
        _gridLayout->addWidget(m_comboBoxClipperNormal, 0, 1);

        connect(m_comboBoxClipperNormal, &PostComboBox::popupAboutToShow, this, []() {
            emit IWidgetSignalInstance->signal_exitAddMarkerState();
            });

        m_labelLocation = new QLabel(this);
        m_labelLocation->setText("位置");
        _gridLayout->addWidget(m_labelLocation, 1, 0);
        StrictRangeDoubleValidator* validator = new StrictRangeDoubleValidator(-999999999, 999999999, 6, this);
        validator->setNotation(QDoubleValidator::StandardNotation); // 使用标准记数法
        m_lineEditClipperOrigin = new PostLineEdit(this);
        QSizePolicy lineEditPolicy = m_lineEditClipperOrigin->sizePolicy();
        lineEditPolicy.setHorizontalPolicy(QSizePolicy::Fixed);
        lineEditPolicy.setVerticalPolicy(QSizePolicy::Fixed);
        m_lineEditClipperOrigin->setSizePolicy(lineEditPolicy);
        m_lineEditClipperOrigin->setFixedSize(QSize(80, 24));
        m_lineEditClipperOrigin->setText("0.0");
        m_lineEditClipperOrigin->setValidator(validator);
        _gridLayout->addWidget(m_lineEditClipperOrigin, 1, 1);
        connect(m_lineEditClipperOrigin, &PostLineEdit::clicked, this, []() {
            emit IWidgetSignalInstance->signal_exitAddMarkerState();
            });

        m_labelLocationUnit = new QLabel(this);
        m_labelLocationUnit->setFixedSize(QSize(25, 24));
        m_labelLocationUnit->setText("mm");
        _gridLayout->addWidget(m_labelLocationUnit, 1, 2);

        ui->toolBar_Display->addWidget(displayToolbarWidget);

        ui->toolBar_Display->addSeparator();

        m_toolButtonFastBack = new QToolButton(this);
        m_toolButtonFastBack->setIcon(QIcon(":/QUI/image/pst_fastBack.png"));
        m_toolButtonFastBack->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonFastBack->setText("快退");
        ui->toolBar_Display->addWidget(m_toolButtonFastBack);

        m_toolButtonPlay = new QToolButton(this);
        m_toolButtonPlay->setIcon(QIcon(":/QUI/image/pst_play.png"));
        m_toolButtonPlay->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonPlay->setText("播放");
        m_toolButtonPlay->setCheckable(true);
        ui->toolBar_Display->addWidget(m_toolButtonPlay);

        m_toolButtonFastForward = new QToolButton(this);
        m_toolButtonFastForward->setIcon(QIcon(":/QUI/image/pst_fastForward.png"));
        m_toolButtonFastForward->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonFastForward->setText("快进");
        m_toolButtonFastForward->setObjectName("pst_DropDownToolbuttonLeft");
        ui->toolBar_Display->addWidget(m_toolButtonFastForward);

        // 动图信息模块Begin
        m_animationInfoBarWidgetLeft = new QWidget();
        auto _animationInfoGridLayoutLeft = new QGridLayout(m_animationInfoBarWidgetLeft);
        m_labelAniamtionInfoType = new QLabel(this);
        m_labelAniamtionInfoType->setText("类型");
        m_labelAniamtionInfoTypeValue = new QLabel(this);
        m_labelAniamtionInfoTypeValue->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
        m_labelAniamtionInfoTypeValue->setFixedSize(QSize(80, 24));

        _animationInfoGridLayoutLeft->addWidget(m_labelAniamtionInfoType, 0, 0);
        _animationInfoGridLayoutLeft->addWidget(m_labelAniamtionInfoTypeValue, 0, 1);

        QWidget* animationInfoValueWidget = new QWidget();
        auto horizontalLayoutvalue = new QHBoxLayout(animationInfoValueWidget);
        m_labelAniamtionInfoValue = new QLabel(this);
        m_labelAniamtionInfoValue->setText("数值");
        m_labelAniamtionInfoValueValue = new QLabel(this);
        m_labelAniamtionInfoValueValue->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");
        m_labelAniamtionInfoValueValue->setFixedSize(QSize(80, 24));

        _animationInfoGridLayoutLeft->addWidget(m_labelAniamtionInfoValue, 1, 0);
        _animationInfoGridLayoutLeft->addWidget(m_labelAniamtionInfoValueValue, 1, 1);
        ui->toolBar_Display->addWidget(m_animationInfoBarWidgetLeft);

        m_animationInfoBarWidgetRight = new QWidget();
        auto _animationInfoVBoxLayoutRight = new QVBoxLayout(m_animationInfoBarWidgetRight);
        m_animationInfoBarWidgetRight->setFixedWidth(120);
        // QWidget* animationInfoUnitWidget = new QWidget();
        // auto horizontalLayoutUnit = new QHBoxLayout(animationInfoUnitWidget);
        auto horizontalLayoutUnit = new QHBoxLayout();
        m_labelAniamtionInfoUnit = new QLabel(this);
        m_labelAniamtionInfoUnit->setText("单位");
        m_labelAniamtionInfoUnitValue = new QLabel(this);
        m_labelAniamtionInfoUnitValue->setStyleSheet("QLabel{border: 1px solid #DEDFE1;}");

        m_labelAniamtionInfoUnitValue->setFixedSize(QSize(80, 24));
        horizontalLayoutUnit->addWidget(m_labelAniamtionInfoUnit, 0);
        horizontalLayoutUnit->addWidget(m_labelAniamtionInfoUnitValue, 1);

        _animationInfoVBoxLayoutRight->addLayout(horizontalLayoutUnit);

        auto horizontalLayoutSlider = new QHBoxLayout();
        horizontalLayoutSlider->setMargin(0);
        horizontalLayoutSlider->setSpacing(4);
        m_SubtractSliderPushButton = new QPushButton();
        m_SubtractSliderPushButton->setStyleSheet(
            "QPushButton {"
            "    image: url(:/rc/Subtract_normal.png);" // 默认状态图标
            "}"
            "QPushButton:hover {"
            "    image: url(:/rc/Subtract_select.png);" // 鼠标悬停时图标
            "}"
            "QPushButton:checked {"
            "    image: url(:/rc/Subtract_select.png);" // 选中状态图标
            "}"
            "QPushButton:disabled {"
            "    image: url(:/rc/Subtract_normal.png);" // 禁用状态图标
            "}");
        m_SubtractSliderPushButton->setFixedHeight(24);
        m_SubtractSliderPushButton->setFixedWidth(24);
        m_sliderAniamtionInfoPosition = new QSlider(Qt::Horizontal);
        m_sliderAniamtionInfoPosition->setFixedHeight(14);
        // m_sliderAniamtionInfoPosition->setFixedWidth(70);
        m_AdditionSliderPushButton = new QPushButton();
        m_AdditionSliderPushButton->setFixedHeight(24);
        m_AdditionSliderPushButton->setFixedWidth(24);
        m_AdditionSliderPushButton->setStyleSheet(
            "QPushButton {"
            "    image: url(:/rc/Addtion_normal.png);" // 默认状态图标
            "}"
            "QPushButton:hover {"
            "    image: url(:/rc/Addtion_select.png);" // 鼠标悬停时图标
            "}"
            "QPushButton:checked {"
            "    image: url(:/rc/Addtion_select.png);" // 选中状态图标
            "}"
            "QPushButton:disabled {"
            "    image: url(:/rc/Addtion_normal.png);" // 禁用状态图标
            "}");

        // horizontalLayoutSlider->addWidget(m_SubtractSliderPushButton, 0);
        horizontalLayoutSlider->addWidget(m_sliderAniamtionInfoPosition, 1);
        // horizontalLayoutSlider->addWidget(m_AdditionSliderPushButton, 2);
        _animationInfoVBoxLayoutRight->addLayout(horizontalLayoutSlider);

        ui->toolBar_Display->addWidget(m_animationInfoBarWidgetRight);
        ui->toolBar_Display->addSeparator();
        // 动图信息模块End

        m_toolButtonDynamicType = new QToolButton(this);
        m_toolButtonDynamicType->setIcon(QIcon(":/QUI/image/pst_dynamicType.png"));
        m_toolButtonDynamicType->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonDynamicType->setPopupMode(QToolButton::InstantPopup);
        m_toolButtonDynamicType->setText("类型：相机");
        m_toolButtonDynamicType->setObjectName("pst_DropDownToolbutton");
        ui->toolBar_Display->addWidget(m_toolButtonDynamicType);
        QMenu* menuSelection = new QMenu(m_toolButtonDynamicType);
        m_actionCamera = menuSelection->addAction("相机动图");
        m_actionData = menuSelection->addAction("数据动图");
        m_toolButtonDynamicType->setMenu(menuSelection);
        connect(m_toolButtonDynamicType, &QToolButton::pressed, this, []() {
            emit IWidgetSignalInstance->signal_exitAddMarkerState();
            });


        m_toolButtonDynamicSetting = new QToolButton(this);
        m_toolButtonDynamicSetting->setIcon(QIcon(":/QUI/image/pst_dynamicSetting.png"));
        m_toolButtonDynamicSetting->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonDynamicSetting->setText("动态设置");
        m_toolButtonDynamicSetting->setObjectName("pst_DropDownToolbuttonRight");
        ui->toolBar_Display->addWidget(m_toolButtonDynamicSetting);

        m_toolButtonExportMotionGraph = new QToolButton(this);
        m_toolButtonExportMotionGraph->setIcon(QIcon(":/QUI/image/pst_exportMotionGraph.png"));
        m_toolButtonExportMotionGraph->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        m_toolButtonExportMotionGraph->setText("导出动图");
        ui->toolBar_Display->addWidget(m_toolButtonExportMotionGraph);
        ui->toolBar_Display->setMovable(false);

        connect(m_toolButtonSelfAdaptation, &QToolButton::clicked, this, &MainWindow::slot_toolButtonSelfAdaptationClicked);
        connect(m_toolButtonAmplify, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonAmplifyClicked);
        connect(m_toolButtonMinification, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonMinificationClicked);
        connect(m_toolButtonTranslation, &QToolButton::clicked, this, &MainWindow::slot_toolButtonTranslationClicked);
        connect(m_toolButtonTranslation, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonTranslationClicked);
        connect(m_toolButtonModelDisplay, &QToolButton::clicked, this, [this]() {
            emit IWidgetSignalInstance->signal_exitAddMarkerState();
            if (getCurrent3DWindowGraphSize()==0)
            {
                if (m_toolButtonModelDisplay->isChecked())
                {
                    auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("未读取到有效结果数据"), EDialogMsg::Error, QStringLiteral("失败"), {QStringLiteral("确定")});
                }
                m_toolButtonModelDisplay->setChecked(false);
                return;
            }
            bool checked = m_toolButtonModelDisplay->isChecked();
            if (checked)
            {
                emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("显示模型正在进行中..."), true);
            }
            else
            {
                emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("显示模型正在取消中..."), true);
            }
            bool success = slot_toolButtonModelDisplay();
            if (success)
            {
                if (checked)
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("显示模型完成！"), false);
                
                }
                else
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("隐藏模型完成！"), false);
                }
            }
            else
            {
                if (checked)
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("显示模型失败！"), false);
                }
                else
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("隐藏模型失败！"), false);
                }
            }
        });

        connect(m_toolButtonRotation, &QToolButton::clicked, this, &MainWindow::slot_toolButtonRotationClicked);
        connect(m_toolButtonRotation, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonRotationClicked);

        connect(m_toolButtonIsometricView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonIsometricViewClicked);
        connect(m_toolButtonTopView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonTopViewClicked);
        connect(m_toolButtonUpwardView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonUpwardViewClicked);
        connect(m_toolButtonFrontView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonFrontViewClicked);
        connect(m_toolButtonRearView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonRearViewClicked);
        connect(m_toolButtonLeftView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonLeftViewClicked);
        connect(m_toolButtonRightView, &QToolButton::clicked, this, &MainWindow::slot_toolButtonRightViewClicked);

        connect(m_toolButtonActiveClipper, &QToolButton::clicked, this, &MainWindow::slot_toolButtonActiveClipperStateChanged);
        // connect(m_toolButtonActiveClipper, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonActiveClipperClicked);
        connect(m_toolButtonActiveClipper, &QToolButton::clicked, this, [this]()
                { 
            
            bool buttonModelDisplayChecked = m_toolButtonModelDisplay->isChecked();
            bool buttonActiveClipperChecked = m_toolButtonActiveClipper->isChecked();
            if (buttonActiveClipperChecked)
            {
                emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面正在进行中..."), true);
            }
            else
            {
                emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面正在取消中..."), true);
            }


            bool success = slot_toolButtonModelDisplay();

            
            // 如果模型隐藏时，不需要要基于success判断
            if (!buttonModelDisplayChecked)
            {
                if (buttonActiveClipperChecked)
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面完成！"), false);
                }
                else
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面已取消！"), false);
                }
                return;
            }
            if (success)
            {
                if (buttonActiveClipperChecked)
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面完成！"), false);
                }
                else
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面已取消！"), false);
                }
            }
            else
            {
                if (buttonActiveClipperChecked)
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面失败！"), false);
                }
                else
                {
                    emit IBaseSignalInstance->signal_UpdateStatusBarInformation(QStringLiteral("剖面取消失败！"), false);
                }
            }
        });
        connect(m_comboBoxClipperNormal, QOverload<int>::of(&QComboBox::currentIndexChanged), m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_comboBoxNormalCurrentIndexChanged);
        connect(m_lineEditClipperOrigin, &QLineEdit::editingFinished, this, [this]()
                { 
                emit IWidgetSignalInstance->signal_exitAddMarkerState();
                m_menuSignalHandlerInstance->slot_clipperOriginValueChanged(m_lineEditClipperOrigin->text().toDouble()); });
        connect(m_toolButtonFastBack, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonFastBackClicked);
        connect(m_toolButtonPlay, &QToolButton::clicked, this, &MainWindow::slot_toolButtonPlayStateChanged);
        //connect(m_toolButtonPlay, &QToolButton::clicked, m_menuSignalHandlerInstance, [this](bool checked)
        //    {
        //        //if (!getCurrent3DWindowGraphSize())
        //        //{
        //        //    return;
        //        //}
        //        m_menuSignalHandlerInstance->slot_toolButtonPlayClicked(checked);
        //    } );
        connect(m_toolButtonFastForward, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonFastForwardClicked);
        connect(m_SubtractSliderPushButton, &QPushButton::clicked, this, &MainWindow::slot_SubtractSliderPushButtonClicked);
        connect(m_AdditionSliderPushButton, &QPushButton::clicked, this, &MainWindow::slot_AddSliderPushButtonClicked);
        connect(m_sliderAniamtionInfoPosition, &QSlider::sliderPressed, this, &MainWindow::slot_SliderPressed);
        connect(m_sliderAniamtionInfoPosition, &QSlider::sliderReleased, this, &MainWindow::slot_SliderReleased);
        connect(m_sliderAniamtionInfoPosition, &QSlider::valueChanged, this, &MainWindow::slot_SliderValueChanged);
        connect(m_toolButtonDynamicType, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonDynamicTypeClicked);
        connect(m_actionCamera, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonDynamicTypeCameraClicked);
        connect(m_actionData, &QAction::triggered, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonDynamicTypeDataClicked);
        connect(m_toolButtonDynamicSetting, &QToolButton::clicked, this, [this]()
                { 
                emit IWidgetSignalInstance->signal_exitAddMarkerState();
                m_menuSignalHandlerInstance->slot_toolButtonDynamicSettingClicked(m_actionCamera->isEnabled(), m_actionData->isEnabled()); });
        connect(m_toolButtonExportMotionGraph, &QToolButton::clicked, m_menuSignalHandlerInstance, &MainWindowSignalHandler::slot_toolButtonExportMotionGraphClicked);

        QShortcut* shortcutSelfAdaptation = new QShortcut(QKeySequence("Ctrl+D"), this);
        connect(shortcutSelfAdaptation, &QShortcut::activated, this, &MainWindow::slot_toolButtonSelfAdaptationClicked);
    }

    void MainWindow::initContentWidget()
    {
        this->setCentralWidget(m_centerWidget);
        // addPageNode("CenterWidget", m_centerWidget, ElaIconType::LocationArrow);

        connect(m_centerWidget, &CenterWidget::signal_fileClicked,
                this, &MainWindow::slot_checkGraphType);
        connect(m_centerWidget, &CenterWidget::signal_getTwoDResultDataPointer,
                this, &MainWindow::slot_getTwoDResultDataPointer);
        connect(m_centerWidget, &CenterWidget::signal_updateMeasureButtonState,
                this, &MainWindow::slot_measureButtonStateChanged);
        connect(m_centerWidget, &CenterWidget::signal_updateStandardCcurveState,
                this, &MainWindow::slot_standardCcurveButtonSctateChanged);
        // m_centerWidget->getTreeView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
        //  初始化按钮状态
        slot_tabBarCurrentChanged();
    }

    void MainWindow::checkFileType(
        const QList<FileDataTypes>& inputType, bool& is2D, bool& isPolar, bool& isSurfaceElectricFiel,
        bool& isTwoDHeatMap, bool& isThreeDCloudMap, bool& isThreeDSurfacePlot, bool& TwoDPeakValleyGraph, bool& isDataTable)
    {
        if (inputType.isEmpty())
        {
            return;
        }
        bool _is2D = true;
        bool _isPolar = true;
        bool _isSurfaceElectricField = true;
        bool _isTwoDHeatMap = true;
        bool _isThreeDCloudMap = true;
        bool _isThreeDSurfacePlot = true;
        bool _TwoDPeakValleyGraph = true;
        bool _isDataTable = true;
        FileDataTypes fileDataType = static_cast<FileDataTypes>(0xff);
        for (const auto& type : inputType)
        {
            fileDataType &= type; // 按位与
        }
        _is2D = _is2D && (fileDataType & FileDataType::File2DCurve);
        _isPolar = _isPolar && (fileDataType & FileDataType::FilePolar);
        _isSurfaceElectricField = _isSurfaceElectricField && (fileDataType & FileDataType::FileSurfaceElectricFieldGraph);
        _isTwoDHeatMap = _isTwoDHeatMap && (fileDataType & FileDataType::FileTwoDHeatMap);
        _isThreeDCloudMap = _isThreeDCloudMap && (fileDataType & FileDataType::FileThreeDCloudMap);
        _isThreeDSurfacePlot = _isThreeDSurfacePlot && (fileDataType & FileDataType::FileThreeDSurfacePlot);
        _TwoDPeakValleyGraph = _TwoDPeakValleyGraph && (fileDataType & FileDataType::FileTwoDPeakValleyGraph);
        _isDataTable = _isDataTable && (fileDataType & FileDataType::FileDataTable);

        is2D = _is2D;
        isPolar = _isPolar;
        isSurfaceElectricFiel = _isSurfaceElectricField;
        isTwoDHeatMap = _isTwoDHeatMap;
        isThreeDCloudMap = _isThreeDCloudMap;
        isThreeDSurfacePlot = _isThreeDSurfacePlot;
        TwoDPeakValleyGraph = _TwoDPeakValleyGraph;
        isDataTable = _isDataTable;

        // 只有二维折线、极坐标允许多选打开
        if (inputType.size() > 1)
        {
            isSurfaceElectricFiel = false;
            isTwoDHeatMap = false;
            isThreeDCloudMap = false;
            isThreeDSurfacePlot = false;
            TwoDPeakValleyGraph = false;
            isDataTable = false;
        }
    }

    void MainWindow::ShowSelecetDataDialog(bool isOpenNewWindow)
    {
        // 保证每次都是一个新的选择框
        // if (m_selecetDataDialog != nullptr)
        //{
        //     m_selecetDataDialog->deleteLater(); m_selecetDataDialog = nullptr;
        // }

        if (m_selectFileList.isEmpty())
        {
            return;
        }

        m_selecetDataDialog = new SelectDatatDialog(this);
        m_selecetDataDialog->set2DPlotType(m_2DPlotType);
        m_selecetDataDialog->setIsOpenNewWindow(isOpenNewWindow);

        auto* textFileParser = m_selectFileList.first();
        const auto& keyNameList = textFileParser->getEachColNameOfKey();
        auto keyDataList = textFileParser->getEachColDataOfKey();
        QList<QPair<QString, QVector<double>>> keyData;
        for (int i = 0; i < keyNameList.size(); ++i)
        {
            keyData.append(QPair<QString, QVector<double>>(keyNameList[i], keyDataList[i]));
        }

        auto valueNameList = textFileParser->getEachColGroupNameOfValue();
        // auto valueDataList = textFileParser->getEachColDataOfValue();
        // QList<QPair<QString, QVector<double>>> valueData;
        // for (int i = 0; i < valueNameList.size(); ++i)
        //{
        //     valueData.append(QPair<QString, QVector<double>>(valueNameList[i], valueDataList[i]));
        // }
        //  m_selecetDataDialog->setFixedSize(280,220);
        //  m_selecetDataDialog->moveToCenter();
        //  m_selecetDataDialog->setWindowModality(Qt::ApplicationModal);
        m_selecetDataDialog->SetOptionalKey(m_optionalKeyList);
        QList<int> selectParserIndex;
        for (auto parser : m_selectFileList)
        {
            selectParserIndex.append(m_pyTextParserList.indexOf(parser));
        }
        m_selecetDataDialog->SetSelectParserIndex(selectParserIndex);
        if (m_2DPlotType == FileDataType::FileTwoDHeatMap)
        {
            m_selecetDataDialog->SetHeatMapFlage(true);
            if (keyNameList.size() < 2)
            {
                int tmpVariableIndex = 0;
                QList<QPair<int, QList<int>>> tmpChosenData;
                QList<int> tmpValueIndexs;
                bool _isSuccess = false;
                slot_sendSelectedInfo(tmpVariableIndex, tmpChosenData, tmpValueIndexs, &_isSuccess);
                // slot_sendSelectedInfo(tmpVariableIndex, tmpChosenData, tmpValueIndexs);
                return;
            }
        }
        else
        {
            m_selecetDataDialog->SetHeatMapFlage(false);
        }
        // m_selecetDataDialog->setDialogTitle("方向性");
        m_selecetDataDialog->setKeyDataList(keyData);
        m_selecetDataDialog->setValueDataList(valueNameList.toList()); // 只需要名字
        m_selecetDataDialog->updateUI();
        m_selecetDataDialog->showWindow();

        // connect(m_selecetDataDialog, &SelectDatatDialog::signal_sendSelectedInfo, this, &MainWindow::slot_sendSelectedInfo);
    }

    void MainWindow::initConnections()
    {
        connect(m_centerWidget, &CenterWidget::signal_addToCurrentGraph, this, &MainWindow::slot_addToCurrentGraph);
        connect(m_centerWidget, &CenterWidget::signal_currentWindowChanged, this, &MainWindow::slot_tabBarCurrentChanged);
        connect(m_centerWidget, &CenterWidget::signal_displayNew2DGraph, [this](FileDataType type, bool isOpenNewWindow)
                {
                m_2DPlotType = type; slot_displayNew2DGraph(isOpenNewWindow); });
        connect(m_centerWidget, &CenterWidget::signal_displayNewSurfaceElectricFieldGraph, this, &MainWindow::slot_displayNewSurfaceElectricFieldGraph);
        connect(m_centerWidget, &CenterWidget::signal_displayNewThreeDCloudMap, this, &MainWindow::slot_displayNewThreeDCloudMap);
        connect(m_centerWidget, &CenterWidget::signal_displayNewThreeDSurfacePlot, this, &MainWindow::slot_displayNewThreeDSurfacePlot);
        connect(m_centerWidget, &CenterWidget::signal_displayInTableWidget, this, &MainWindow::slot_displayInTableWidget);
        connect(m_centerWidget, &CenterWidget::signal_pasteFile, this, &MainWindow::slot_pasteFile);

        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_clearCurrentProjectAllData, this, &MainWindow::slot_clearCurrentProjectAllData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_openProjectFile, this, &MainWindow::slot_OpenProjectFile);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_saveProjectResult, this, &MainWindow::slot_saveProjectData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::singal_toolButtonDataImport, this, &MainWindow::slot_toolBtnImportDataClick);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_set2DPlotType, this, &MainWindow::solt_set2DPlotType);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_sendSelectedInfo, this, &MainWindow::slot_sendSelectedInfo);
        // connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_openProject, this, &MainWindow::slot_importProjectData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_sendThreeDSurfacePlotData, this, &MainWindow::slot_receiveThreeDSurfacePlotData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_sendThreeDCloudMapData, this, &MainWindow::slot_receiveThreeDCloudMapData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_sendSurfaceElectricFieldGraphData, this, &MainWindow::slot_receiveSurfaceElectricFieldGraphData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_sendTableWidgetData, this, &MainWindow::slot_receiveTableData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_hideOrShowTableColumn, this, &MainWindow::slot_hideOrShowTableColumn);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_changeTbColumnName, this, &MainWindow::slot_changeTbColumnName);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_exportTbData, this, &MainWindow::slot_exportTbData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_flushTbBySelectedRow, this, &MainWindow::slot_flushTbBySelectedRow);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_highlightSelectedTbColumns, this, &MainWindow::slot_highlightSelectedTbColumns);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjFileWrite, this, &MainWindow::slot_doPrjFileWrite);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjFileRead, this, &MainWindow::slot_doPrjFileRead);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjCloseTree, this, &MainWindow::slot_doPrjCloseTree);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreeCopyDir, this, &MainWindow::slot_doPrjTreeCopyDir);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreePasteDir, this, &MainWindow::slot_doPrjTreePasteDir);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreeCopyData, this, &MainWindow::slot_doPrjTreeCopyData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreePasteData, this, &MainWindow::slot_doPrjTreePasteData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreeExpandDir, this, &MainWindow::slot_doPrjTreeExpandDir);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_doPrjTreeCollapseDir, this, &MainWindow::slot_doPrjTreeCollapseDir);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_closeCenterTableBar, this, &MainWindow::slot_closeCenterTableBar);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_changeCurrentTabBar, this, &MainWindow::slot_changeCurrentTabBar);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_submitEvaluation, this, &MainWindow::slot_submitEvaluation);

        //模型显示
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_saveModelDisplaySettingData, this, &MainWindow::slot_modelDisplaySettingData);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_saveActiveClipperSettingData, this, &MainWindow::slot_ActiveClipperSettingData);

        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_importProjectData, this, [this](QList<QString> filePaths)
                {
                m_inputDirList.clear();
                m_inputDirList = filePaths;
                return slot_importProjectDataInternal(true); });

        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_exportPstData, [=](QString filePath)
                { exportPstData(filePath); });

        connect(IWidgetSignalInstance, &BaseWidget::IWidgetSignal::signal_closeTree, this, &MainWindow::RecycleReaderByItems);
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_textImportDataWriteConfig, []()
                { DataImportConfigurationDataInstance->writeConfig(); });
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_textImportDataReadConfig, []()
                { DataImportConfigurationDataInstance->readConfig(); });
        connect(IBaseSignalInstance, &BaseWidget::IWidgetSignal::signal_removeImprotTextData, [=](int itemID)
                { DataImportConfigurationDataInstance->removeTextImportDataByItemID(itemID); });
    }

    void MainWindow::setToolButtonFastBackState(bool state)
    {
        m_toolButtonFastBack->setEnabled(state);
    }
    void MainWindow::setToolButtonFastForwardState(bool state)
    {
        m_toolButtonFastForward->setEnabled(state);
    }
    void MainWindow::slot_setToolButtonExportMotionGraph2InterfaceState(bool state) {
        /*
         * 导出动图的时候禁用其他操作项
         */

        auto currentGraph = m_centerWidget->getCurrentGraphWindow();

        m_centerWidget->getTreeView()->setEnabled(state);
        m_centerWidget->getTabWidget()->setEnabled(state);
        ui->mainToolBar->setEnabled(state);

        m_toolButtonSelfAdaptation->setEnabled(state); // 自适应
        m_toolButtonAmplify->setEnabled(state);        // 放大
        m_toolButtonMinification->setEnabled(state);   // 缩小
        m_toolButtonTranslation->setEnabled(state);    // 平移

        // 如果不是二维热力图
        if (qobject_cast<HeatMapWindow*>(currentGraph) == nullptr)
        {
            m_toolButtonRotation->setEnabled(state);      // 旋转
            m_toolButtonIsometricView->setEnabled(state); // 等距视图
            m_toolButtonTopView->setEnabled(state);       // 俯视图
            m_toolButtonUpwardView->setEnabled(state);    // 仰视图
            m_toolButtonFrontView->setEnabled(state);     // 正视图
            m_toolButtonRearView->setEnabled(state);      // 后视图
            m_toolButtonLeftView->setEnabled(state);      // 左视图
            m_toolButtonRightView->setEnabled(state);     // 右视图
            m_toolButtonModelDisplay->setEnabled(state);  // 模型显示
            m_toolButtonActiveClipper->setEnabled(state); // 剖面
            m_labelNormal->setEnabled(state);             // 法向
            m_labelLocation->setEnabled(state);           // 位置
            m_labelLocationUnit->setEnabled(state);       // 位置单位
            m_comboBoxClipperNormal->setEnabled(state);   // 法向
            m_lineEditClipperOrigin->setEnabled(state);   // 位置
        }

        // m_toolButtonFastBack->setEnabled(state);       // 快退
        m_toolButtonPlay->setEnabled(state); // 播放
        // m_toolButtonFastForward->setEnabled(state);    // 快进

        m_animationInfoBarWidgetLeft->setEnabled(state);  // 动画信息栏左部分
        m_animationInfoBarWidgetRight->setEnabled(state); // 动画信息栏右部分

        m_toolButtonDynamicType->setEnabled(state); // 类型：相机
        // m_actionCamera->setEnabled(state);             // 类型：相机
        // m_actionData->setEnabled(state);               // 类型：相机
        m_toolButtonDynamicSetting->setEnabled(state); // 动态设置
    }
    void MainWindow::setToolButtonExportMotionGraphState(bool state)
    {
        m_toolButtonExportMotionGraph->setEnabled(state);
    }

    double caculateGraphValueByKey(double key, QSharedPointer<QCPGraphDataContainer> graphData)
    {
        double value = std::numeric_limits<double>::quiet_NaN();
        const auto& iter = graphData->findBegin(key, false);
        // x点在线段范围中
        if (iter != graphData->constEnd())
        {
            // 原始数据点
            if (qFuzzyCompare(iter->key, key))
            {
                value = iter->value;
            }
            // 非原始数据点，线性插值计算y值
            else
            {
                bool hasData = false;
                QCPRange keyRange = graphData->keyRange(hasData);
                if (hasData && (keyRange.contains(key)))
                {
                    const auto& previousIter = graphData->findBegin(key);  // 距离最近的前一个原始数据点
                    const auto& nextIter = graphData->findEnd(key, false); // 距离最近的后一个原始数据点
                    double k = (nextIter->value - previousIter->value) / (nextIter->key - previousIter->key);
                    value = previousIter->value + k * (key - previousIter->key);
                }
            }
        }
        return value;
    }

    void MainWindow::exportCommonGraphDatas(QVector<QPair<QString, QVector<double>>>& datas,
                                            Graph2DWindowBase* window, const QVector<double>& keyData)
    {
        Curve2DPlotor* plotor = window->getPlotor();

        const auto& curveMap = window->getCurve();
        for (const auto& infoPair : curveMap)
        {
            QCPGraph* graph = qobject_cast<QCPGraph*>(infoPair.second->getCurveLineAddress());
            if (graph == nullptr)
            {
                continue;
            }
            QSharedPointer<QCPGraphDataContainer> graphData(graph->data());
            QVector<double> valueData;
            valueData.reserve(keyData.size());
            for (double key : keyData)
            {
                double value = caculateGraphValueByKey(key, graphData);
                valueData.append(value);
            }
            QString unit;
            auto reder = infoPair.second->getReader();
            int index = reder->getRealValueIndex(infoPair.second->getValueIndex(), infoPair.second->getValueComponent());
            const auto& unitValueVector = reder->getEachColUnitOfValue();
            if (index <= unitValueVector.size())
            {
                unit = unitValueVector.at(index);
            }
            else
            {
                unit = unitValueVector.first();
            }
            unit = unit.trimmed();
            datas.append(qMakePair(graph->name() + QString("||%1").arg(unit), std::move(valueData)));
        }
    }

    void MainWindow::exportHeatMapDatas(QVector<QPair<QString, QVector<double>>>& datas, Graph2DWindowBase* window, const QVector<double>& keyData)
    {
        Curve2DPlotor* plotor = window->getPlotor();

        auto colorMap = qobject_cast<QCPColorMap*>(plotor->plottable());
        if (colorMap == nullptr)
        {
            return;
        }
        const auto& curveMap = window->getCurve();
        if (curveMap.size() != 1)
        {
            return;
        }
        for (const auto& infoPair : curveMap)
        {
            QCPColorMap* colorMap = qobject_cast<QCPColorMap*>(infoPair.second->getCurveLineAddress());
            if (colorMap == nullptr)
            {
                continue;
            }
            auto data = colorMap->data();
            int xSize = data->keySize();
            int ySize = data->valueSize();
            QVector<double> xData, yData, valueData;
            xData.reserve(xSize * ySize);
            yData.reserve(xSize * ySize);
            valueData.reserve(xSize * ySize);
            for (int i = 0; i < xSize; ++i)
            {
                for (int j = 0; j < ySize; ++j)
                {
                    double x, y;
                    data->cellToCoord(i, j, &x, &y);
                    xData.append(x);
                    yData.append(y);
                    valueData.append(data->cell(i, j));
                }
            }
            datas[0].second = std::move(xData);
            QString yName = infoPair.second->getReader()->getEachColNameOfKey().at(infoPair.second->getReader()->getSecondScanParameterIndex());
            QString unit;
            auto reder = infoPair.second->getReader();
            int index = infoPair.second->getScanParameterIndex();
            const auto& unitVector = reder->getEachColUnitOfKey();
            if (index <= unitVector.size())
            {
                unit = unitVector.at(index);
            }
            else
            {
                unit = unitVector.first();
            }
            unit = unit.trimmed();
            yName.append(QString("||%1").arg(unit));
            datas.append(qMakePair(yName, std::move(yData)));
            index = reder->getRealValueIndex(infoPair.second->getValueIndex(), infoPair.second->getValueComponent());
            const auto& unitValueVector = reder->getEachColUnitOfValue();
            if (index <= unitValueVector.size())
            {
                unit = unitValueVector.at(index);
            }
            else
            {
                unit = unitValueVector.first();
            }
            unit = unit.trimmed();
            datas.append(qMakePair(colorMap->name() + QString("||%1").arg(unit), std::move(valueData)));
        }
    }

    void MainWindow::exportPolarGraphDatas(QVector<QPair<QString, QVector<double>>>& datas,
                                           Graph2DWindowBase* window, const QVector<double>& keyData)
    {
        Curve2DPlotor* plotor = window->getPlotor();
        PolarCoordinateGraphWindow* polarWindow = qobject_cast<PolarCoordinateGraphWindow*>(window);
        const auto& curveMap = window->getCurve();

        for (const auto& curvePair : curveMap)
        {
            PolarGraph* graph = qobject_cast<PolarGraph*>(curvePair.second->getCurveLineAddress());
            if (!graph)
            {
                qWarning() << "MainWindow::exportPolarGraphDatas(): Unexpected error, the PolarGraph is null";
                continue;
            }

            QSharedPointer<QCPGraphDataContainer> graphData(graph->data());
            QVector<double> valueData;
            valueData.reserve(keyData.size());
            for (double key : keyData)
            {
                double value = caculateGraphValueByKey(key, graphData);
                valueData.append(value);
            }
            QString unit;
            auto reder = curvePair.second->getReader();
            int index = reder->getRealValueIndex(curvePair.second->getValueIndex(), curvePair.second->getValueComponent());
            const auto& unitValueVector = reder->getEachColUnitOfValue();
            if (index <= unitValueVector.size())
            {
                unit = unitValueVector.at(index);
            }
            else
            {
                unit = unitValueVector.first();
            }
            unit = unit.trimmed();
            datas.append(qMakePair(graph->name() + QString("||%1").arg(unit), std::move(valueData)));
        }
    }

    void MainWindow::ReadStandardExampleData()
    {
        QDir currentDir = QApplication::applicationDirPath();
        if (currentDir.cd("../StandardFileLibrary/StandardExampleData"))
        {
            const auto& infoList = currentDir.entryInfoList(QDir::Files);
            for (const auto& info : infoList)
            {
                if (info.suffix() == "txt")
                {
                    TextFileReader* textFileReader = new TextFileReader(this);
                    textFileReader->SetFileName(info.absoluteFilePath());
                    textFileReader->setFileDealType(-1);
                    textFileReader->setFileComponentType(0);
                    textFileReader->update();

                    TextFileParser* textFileparser = new TextFileParser(this);
                    textFileparser->SetFileName(info.absoluteFilePath());
                    textFileparser->SetInputTable(textFileReader->getOutputTable());
                    textFileparser->setFileDealType(textFileReader->getFileDealType());
                    textFileparser->setFileComponentType(textFileReader->getFileComponentType());
                    bool isSuccess = textFileparser->Update();
                    if (isSuccess)
                    {
                        m_fileValueData.append(qMakePair(info.completeBaseName(), textFileparser->getEachColNameOfValue().toList()));
                        m_standardExampleData.append(textFileparser);
                        m_comboBoxStandardSelection->addItem(info.completeBaseName());
                    }
                    else
                    {
                        delete textFileparser;
                    }
                }
            }
        }
    }

    void MainWindow::ReadHIRFExtrapolation()
    {
        QDir currentDir = QApplication::applicationDirPath();
        if (currentDir.cd("../StandardFileLibrary/HIRFExtrapolation"))
        {
            const auto& infoList = currentDir.entryInfoList(QDir::Files);
            for (const auto& info : infoList)
            {
                if (info.suffix() == "txt")
                {
                    TextFileReader* textFileReader = new TextFileReader(this);
                    textFileReader->SetFileName(info.absoluteFilePath());
                    textFileReader->setFileDealType(-1);
                    textFileReader->setFileComponentType(0);
                    textFileReader->update();

                    TextFileParser* textFileparser = new TextFileParser(this);
                    textFileparser->SetFileName(info.absoluteFilePath());
                    textFileparser->SetInputTable(textFileReader->getOutputTable());
                    textFileparser->setFileDealType(textFileReader->getFileDealType());
                    textFileparser->setFileComponentType(textFileReader->getFileComponentType());
                    bool isSuccess = textFileparser->Update();
                    if (isSuccess)
                    {
                        m_HIRFExtrapolation.append(textFileparser);
                    }
                    else
                    {
                        delete textFileparser;
                    }
                }
            }
        }
    }

    void MainWindow::exportPstData(QString fileDestPath)
    {
        QString fileSaveDestPath = "";
        auto window = m_centerWidget->getCurrentGraphWindow();
        if (qobject_cast<Graph2DWindowBase*>(window) != nullptr)
        {
            auto graph2D = qobject_cast<Graph2DWindowBase*>(window);

            const auto& plotor = graph2D->getPlotor();
            const auto& curveMap = graph2D->getCurve();
            QString keyName;
            QVector<double> keyData;
            // 获取所有x数据值
            for (const auto& curvePair : curveMap)
            {
                keyName = curvePair.second->getXData().first;
                keyData.append(curvePair.second->getXData().second);
                QString unit;
                auto reder = curvePair.second->getReader();
                int index = curvePair.second->getScanParameterIndex();
                const auto& unitVector = reder->getEachColUnitOfKey();
                unit = index <= unitVector.size() ? unitVector.at(index) : unitVector.first();
                unit = unit.trimmed();
                keyName.append(QString("||%1").arg(unit));
            }
            std::set set(keyData.begin(), keyData.end()); // 保持数据顺序去重
            keyData = QVector<double>::fromStdVector(std::vector(set.begin(), set.end()));

            QVector<QPair<QString, QVector<double>>> datas; // 所有数据数组
            datas.append(qMakePair(keyName, keyData));      // 添加x数据

            bool isHeatMap = false;
            if (qobject_cast<PolarCoordinateGraphWindow*>(window) != nullptr)
            {
                exportPolarGraphDatas(datas, graph2D, keyData);
            }
            else if (qobject_cast<HeatMapWindow*>(window) != nullptr)
            {
                isHeatMap = true;
                exportHeatMapDatas(datas, graph2D, keyData);
            }
            else
            {
                exportCommonGraphDatas(datas, graph2D, keyData);
            }

            // 初步写入数据到txt文件
            fileSaveDestPath = fileDestPath.isEmpty() ? QFileDialog::getSaveFileName(this, tr("导出数据"), "", tr("csv 文件 (*.csv);;txt 文件 (*.txt)")) : fileDestPath;
            if (fileSaveDestPath.isEmpty())
            {
                return;
            }
            UpdateStatusBarInformation(QString("导出数据正在进行中..."), true);
            QFile file(fileSaveDestPath);
            if (file.open(QIODevice::WriteOnly | QIODevice::Text))
            {
                QTextStream out(&file);
                // 设置 QTextStream 的编码为 UTF-8
                out.setCodec("UTF-8");
                // 可选：写入 BOM，如果需要 Excel 正确识别 UTF-8 BOM
                file.write("\xEF\xBB\xBF");

                out << "# comac datafile version 1.0" << "\n";

                QStringList dataName;
                for (auto iter = datas.begin(); iter != datas.end(); ++iter)
                {
                    QString str = QString("%1||").arg(iter->first);
                    if (iter == datas.begin())
                    {
                        str.append("key");
                    }
                    else
                    {
                        if (isHeatMap)
                        {
                            auto it = iter;
                            --it;
                            QString tmp = it == datas.begin() ? "key" : "value";
                            str.append(tmp);
                        }
                        else
                        {
                            str.append("value");
                        }
                    }
                    dataName.append(str);
                }
                out << "# " + dataName.join(" , ") << "\n";

                int num = datas.first().second.size();
                for (int i = 0; i < num; ++i)
                {
                    QStringList dataValue;
                    for (const auto& data : datas)
                    {
                        dataValue.append(QString::number(data.second.at(i), 'E', 8));
                    }
                    out << dataValue.join(" , ") << "\n";
                }
                file.close();
                UpdateStatusBarInformation(QString("导出数据成功！"), false);
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导出数据成功！"), EDialogMsg::Normal, QStringLiteral("成功"), {QStringLiteral("确定")});
            }
            else
            {
                UpdateStatusBarInformation(QString("导出数据失败！"), false);
                IBaseSignalInstance->signal_sendErrorMessageToUI("导出数据失败");
            }
        }
        else if (qobject_cast<TableChatWindow*>(window) != nullptr)
        {
            TableChatWindow* graph = qobject_cast<TableChatWindow*>(window);
            fileSaveDestPath = fileDestPath.isEmpty() ? QFileDialog::getSaveFileName(this, tr("导出数据"), "", tr("csv 文件 (*.csv);;txt 文件 (*.txt)")) : fileDestPath;
            if (fileSaveDestPath.isEmpty())
            {
                return;
            }
            UpdateStatusBarInformation(QString("导出数据正在进行中..."), true);
            QCoreApplication::processEvents();
            QFile desFile(fileSaveDestPath);
            if (desFile.exists())
            {
                desFile.remove();
            }
            bool isSuc = graph->exportTableData(fileSaveDestPath);
            if (!isSuc)
            {
                UpdateStatusBarInformation(QString("导出数据失败！"), false);
                IBaseSignalInstance->signal_sendErrorMessageToUI("导出数据失败");
            }
            else
            {
                UpdateStatusBarInformation(QString("导出数据成功"), false);
                auto _res = IdaDialogMsg::showDialog(nullptr, QStringLiteral("导出数据成功！"), EDialogMsg::Normal, QStringLiteral("成功"), {QStringLiteral("确定")});
            }
        }
        else if (qobject_cast<Graph3DWindowBase*>(window) != nullptr)
        {
            // 需要导出python脚本，走以前的逻辑
            if (fileDestPath.isEmpty())
            {
                qobject_cast<Graph3DWindowBase*>(window)->exportSourceDataToLocal();
                return;
            }
            qobject_cast<Graph3DWindowBase*>(window)->pyExportSourceDataToLocal(fileDestPath);
            return;
        }
        if (fileDestPath.isEmpty() && !fileSaveDestPath.isEmpty())
        {
            QString tmp = "\"" + fileSaveDestPath + "\"";
            QString pyCode = QString("%1%2%3").arg("PostProcessing.exportData(").arg(tmp).arg(")");
            emit IBaseSignalInstance->signal_execPYCode(QStringList{pyCode}, true, false);
        }
    }

    // 表格数据
    void MainWindow::slot_hideOrShowTableColumn(int windowId, QString selectedIndex)
    {
        m_centerWidget->pyHideOrShowTableColumn(windowId, selectedIndex);
    }

    void MainWindow::slot_changeTbColumnName(int windowId, int index, QString newName)
    {
        m_centerWidget->pyChangeTbColumnName(windowId, index, newName);
    }

    void MainWindow::slot_flushTbBySelectedRow(int windowId, QString parms)
    {
        m_centerWidget->pyFlushTbBySelectedRow(windowId, parms);
    }

    void MainWindow::slot_exportTbData(int windowId, QString filePath, QString delimiter, int onlyVisible)
    {
        m_centerWidget->pyExportTbData(windowId, filePath, delimiter, onlyVisible);
    }

    void MainWindow::slot_highlightSelectedTbColumns(int windowId, QString parms)
    {
        m_centerWidget->pyHighlightSelectedTbColumns(windowId, parms);
    }

    void MainWindow::slot_doPrjCloseTree(int index)
    {
        m_centerWidget->pyDoPrjCloseTree(index);
    }

    void MainWindow::slot_doPrjTreeCopyDir(int index)
    {
        m_centerWidget->pyDoPrjTreeCopyDir(index);
    }

    void MainWindow::slot_doPrjTreePasteDir(int srcId, int destId)
    {
        m_centerWidget->pyDoPrjTreePasteDir(srcId, destId);
    }

    void MainWindow::slot_doPrjTreeCopyData(int index)
    {
        m_centerWidget->pyDoPrjTreeCopyData(index);
    }

    void MainWindow::slot_doPrjTreePasteData(int srcId, int destId)
    {
        m_centerWidget->pyDoPrjTreePasteData(srcId, destId);
    }

    void MainWindow::slot_doPrjTreeExpandDir(int index)
    {
        m_centerWidget->pyDoPrjTreeExpandDir(index);
    }

    void MainWindow::slot_doPrjTreeCollapseDir(int index)
    {
        m_centerWidget->pyDoPrjTreeCollapseDir(index);
    }

    void MainWindow::slot_closeCenterTableBar(int index)
    {
        m_centerWidget->pyCloseCenterTableBar(index);
    }

    void MainWindow::slot_changeCurrentTabBar(int index)
    {
        m_centerWidget->pyChangeCurrentTabBar(index);
    }

    void MainWindow::slot_submitEvaluation(int windowId, int evaluationType, QString parms)
    {
        m_centerWidget->pySubmitEvaluation(windowId, evaluationType, parms);
    }

    void MainWindow::slot_modelDisplaySettingData(int windowUniversalID, bool toolButtonActiveClipperIsChecked, bool toolButtonModelDisplayIsChecked, bool hasAnyGeometrySuccess)
    {
        if (!getCurrent3DWindowGraphSize())
        {
            return;
        }
        m_toolButtonActiveClipper->setChecked(toolButtonActiveClipperIsChecked);
        m_toolButtonModelDisplay->setChecked(toolButtonModelDisplayIsChecked);

        m_menuSignalHandlerInstance->py_updateClipperAndGeometry(windowUniversalID,
                                                                 toolButtonActiveClipperIsChecked, toolButtonModelDisplayIsChecked, hasAnyGeometrySuccess);
        if (!hasAnyGeometrySuccess)
        {
            m_toolButtonModelDisplay->setChecked(false);
            m_menuSignalHandlerInstance->setActiveGeometryState(false);
        }
    }

    void MainWindow::slot_ActiveClipperSettingData(int windowUniversalID, bool toolButtonActiveClipperIsChecked, bool toolButtonModelDisplayIsChecked, bool hasAnyGeometrySuccess, QString direction, double clipperValue)
    {
        m_menuSignalHandlerInstance->py_activeClipperSettingData(windowUniversalID, toolButtonActiveClipperIsChecked, toolButtonModelDisplayIsChecked, hasAnyGeometrySuccess, direction, clipperValue);
    }

    void MainWindow::slot_doPrjFileWrite(QString fileName)
    {
        UpdateStatusBarInformation(QStringLiteral("保存工程结果正在进行中..."), true);
        QCoreApplication::processEvents();
        auto _writer = new ProjectManager::ProjectFileIO(fileName, ProjectManager::ProjectOperateType::Save);
        _writer->setSavePy(false);
        _writer->startThread();
        UpdateStatusBarInformation(QStringLiteral("保存工程结果完成!"), false);
    }

    void MainWindow::slot_doPrjFileRead(QString fileName)
    {
        auto _reader = new ProjectManager::ProjectFileIO(fileName, ProjectManager::ProjectOperateType::Open);
        _reader->setSavePy(false);
        _reader->startThread();
        while (!_reader->isFinished())
        {
            QThread::sleep(1);
        }
        qDebug() << "执行脚本导入工程文件完成";
    }

    void MainWindow::writeImportedTextToProjectTempIO(vtkTable* table, const QString fileName)
    {
        if (table == nullptr)
        {
            qDebug() << __func__ << "Input table is null.";
            return;
        }

        auto fileToWrite = BaseModule::GlobalHelper::getInstance()->getProjectTempIODir() + "/importDatas/" + fileName;
        QFile file(fileToWrite);
        if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
        {
            qDebug() << "Unable to open file " << fileName;
        }

        QTextStream out(&file);

        // 提取 HeadComment 字段内容，作为该 table 的第一行输出
        vtkStringArray* headCommentArray = vtkStringArray::SafeDownCast(table->GetFieldData()->GetAbstractArray("HeadComment"));
        if (!headCommentArray || headCommentArray->GetNumberOfValues() == 0)
        {
            qDebug() << "Table " << /*i << */" has no ‘HeadComment’.";
        }
        QString headComment = QString::fromStdString(headCommentArray->GetValue(0));
        out << headComment << "\n";

        // 写入表头（列名称），列之间使用逗号分隔
        out << "# ";
        QStringList headers;
        for (int col = 0; col < table->GetNumberOfColumns(); ++col)
        {
            QString colName = QString::fromStdString(table->GetColumnName(col));
            headers << colName;
        }
        out << headers.join(",") << "\n";

        // 写入数据行，每行数据各字段间以逗号分隔
        for (vtkIdType row = 0; row < table->GetNumberOfRows(); ++row)
        {
            QStringList rowValues;
            for (int col = 0; col < table->GetNumberOfColumns(); ++col)
            {
                vtkVariant val = table->GetValue(row, col);
                rowValues << QString::fromStdString(val.ToString());
            }
            out << rowValues.join(",") << "\n";
        }

        file.close();
    }

    //---------------以下是生成报告相关----------------
    void MainWindow::slot_openReportModel()
    {
        // hideAllSubWindow();
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        InitChildReportProcess();
    }

    void MainWindow::InitChildReportProcess()
    {
        const char* targetProcessName = "GenerateReport.exe";
        DWORD processId = GetProcessIdByName1(targetProcessName);
        HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, processId);
        if (hProcess != NULL)
        {
            CloseHandle(hProcess);
        }
        else
        {
            if (m_report)
            {
                delete m_report;
                m_report = nullptr;
            }
        }

        if (!m_report)
        {
#ifdef _DEBUG
            QString cmd = qApp->applicationDirPath() + "/GenerateReport.exe"; // 子程序文件路径
#else
            QString cmd = qApp->applicationDirPath() + "/GenerateReport.exe"; // 子程序文件路径
#endif
            m_report = new QProcess(this); // 使用进程运行子进程窗口
            // connect(m_report, &QProcess::readyReadStandardOutput, this, &MainWindow::handleChildReportProcessMsg);
            m_report->setReadChannel(QProcess::StandardOutput);
            m_report->start(cmd, QStringList()); // 把父窗口的id传到子进程中
            QByteArray command("{--}screenshootToReport{||}NO{--}\n");
            std::cout << "ReportProcess" << std::endl;
            m_report->write(command);
        }
    }

    void MainWindow::slot_screenshootToReport()
    {
        emit IWidgetSignalInstance->signal_exitAddMarkerState();
        ClearClipboard();
        QPixmap screenshot = captureScreenShot();
        if (screenshot.isNull())
            return;

        std::cout << "screenclip success" << std::endl;

        const char* targetProcessName = "GenerateReport.exe";
        DWORD processId = GetProcessIdByName1(targetProcessName);
        HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, processId);
        if (hProcess != NULL)
        {
            CloseHandle(hProcess);
        }
        else
        {
            if (m_report)
            {
                delete m_report;
                m_report = nullptr;
            }
        }

        // 生成报告进程exe还未启动时，先启动，再发信号
        if (!m_report)
        {
            slot_openReportModel();
        }
        // 调用GenerateReport.exe
        QByteArray command("{--}screenshootToReport{||}YES{--}\n");
        std::cout << "screenshootToReport" << std::endl;
        m_report->write(command);
    }

    // 封装截图流程的函数，函数内启动截图窗口并使用局部事件循环等待操作结束
    QPixmap MainWindow::captureScreenShot()
    {
        QPixmap result;
        QEventLoop loop;

        // 动态创建截图窗口
        ScreenCaptureWidget* captureWidget = new ScreenCaptureWidget();
        QObject::connect(captureWidget, &ScreenCaptureWidget::captureFinished,
                         [&](const QPixmap& pixmap)
                         {
                             result = pixmap;
                             loop.quit();
                         });

        captureWidget->show();
        loop.exec(); // 局部事件循环，等待截图完成
        captureWidget->deleteLater();

        return result;
    }
    //---------------以上是生成报告相关----------------
} // namespace pst
